strspn
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
strspn
(
string $string
,
string $characters
,
int $offset
=
0
,
?
int $length
=
null
):
int
composer/composer
public function
isAbsolutePath
(
string $file
)
{
return
''
!==
$file
&& (
strspn
(
$file
,
'/\\'
,
0
,
1
)
|| (
\strlen
(
$file
) >
3
&&
ctype_alpha
(
$file
[
0
])
&&
':'
===
$file
[
1
]
&&
strspn
(
$file
,
'/\\'
,
2
,
1
)
tests/Composer/Test/Fixtures/functional/installed-versions2/vendor/symfony/filesystem/Filesystem.php
composer/composer
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
)
);
tests/Composer/Test/Fixtures/functional/installed-versions2/vendor/symfony/filesystem/Filesystem.php