PHP See What Portion Of String Is Composed Only Of Given Set Of Characters – String Function

 
    <?
$twister = "Peter Piper picked a peck of pickled peppers";
$charset = "Peter picked a";
print("The segment matching '$charset' is " . strspn($twister, $charset) . " characters long");
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.