strspn

 int strspn ( string $subject , string $mask [, int $start [, int $length ]] ) 

説明

Finds the length of the initial segment of subject that contains only characters from mask. If start and length are omitted, then all of subject will be examined. If they are included, then the effect will be the same as calling strspn(substr($subject, $start, $length), $mask) (see substr for more information). The line of code:
<?php$var = strspn("42 is the answer to the 128th question.", "1234567890");?>

will assign 2 to $var, because the string "42" is the initial segment of subject that consists only of characters contained within "1234567890".

戻り値

Returns the length of the initial segment of subject which consists entirely of characters in mask.