Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask
<?php strspn(    string $string,    string $characters,    int $offset = 0,    ?int $length = null): int
<?php     public function isAbsolutePath(string $file)

    {

        return '' !== $file && (strspn($file, '/\\', 0, 1)

            || (\strlen($file) > 3 && ctype_alpha($file[0])

                && ':' === $file[1]

                && strspn($file, '/\\', 2, 1)
<?php         return '' !== $file && (strspn($file, '/\\', 0, 1)

            || (\strlen($file) > 3 && ctype_alpha($file[0])

                && ':' === $file[1]

                && strspn($file, '/\\', 2, 1)

            )

            || null !== parse_url($file, \PHP_URL_SCHEME)

        );