The strspn() function returns number of characters found in the string from the charlist parameter.
Syntax
strspn(str,charlist,begin,len)
Parameters
str − The string to search
charlist − The characters to find
begin − Where to begin in the string
len − Length of the string
Return
The strspn() function returns number of characters found in the string from the charlist parameter. It returns false if string is not found.
Example
The following is an example −
<?php echo strspn("mobilephone","o"); ?>
Output
The following is the output −
0