PHP strspn Function
What is strspn Function?
Explanation
In PHP this function returns the number of characters found in the string that contains only characters from the charlist.
Syntax:
strspn(string,char,start,length)
The above syntax specifes the "string" to be search, "char" specifies the characters to be searched for, "start" specifes where to start search,"length" specifes the length of the string.
Example :
<?php
echo strspn("42 code for the question...", "1234567890");
?>
Result :
2
In the above strspn function example only 2 characters from the character list is present in the string, hence returns "2".