September 2001
Intermediate to advanced
768 pages
32h 45m
English
int strcspn(string string, string mask)
Returns the number of characters present in string before any part of mask is found.
Returns:
String
Description:
strcspn() returns the number of characters that occur between the start of string and the first occurrence of any character listed in mask .
strcspn() provides a simple way to parse strings and validate data. It is not commonly used in PHP—many other functions exist in the language that eclipse it in power and convenience.
Version:
PHP 3.0.3+, PHP 4+
See also:
To find the length of an initial substring containing only certain characters:
strspn()
Other functions that count the number or occurrence of characters or strings within a string:
count_chars() strlen() substr_count() ...
Read now
Unlock full access