See what portion of a string is composed only of a given set of characters : strcspn : String PHP Source Code


PHP Source Code » String » strcspn »

 

See what portion of a string is composed only of a given set of characters




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



HTML code for linking to this page:

    PHP Function Reference -> Users Code Examples / Notes - > strcspn:
  • strcspn
Follow Navioo On Twitter

PHP Source Code

 Navioo String
» strcspn