strcspn() function returns the length of the first segment in string1 containing characters not in string2. : strspn « String « PHP






strcspn() function returns the length of the first segment in string1 containing characters not in string2.

 
Its syntax is: int strcspn (string str1, string str2)

<?
$password = "12345";
if (strcspn($password, "1234567890") == 0) :
     print "Password cannot consist solely of numbers!";
endif;
?>
  
  








Related examples in the same category

1.strspn() function returns the length of the first segment in string1 containing characters also in string2.
2.strspn.php
3.strcspn demo