English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The strspn() function is used to return the number of characters in the string that contain the charlist parameter specified.
strspn(string,charlist,start,length)
Returns the number of characters in the string that contain the charlist parameter specified.
Returns the number of characters in the string that contain the charlist parameter specified; if the string is not found, it returns false
Serial Number | Parameters and Description |
---|---|
1 | string It specifies the string to be searched |
2 | length Define the length of the string |
3 | start It specifies where to start |
4 | charlist Specify the character to be searched |
Try the following example to return the number of characters in the string "Hello world!" that contain the character "kHlleo":
<?php //Returns the number of characters in the string "Hello world!" that contain the character "kHlleo" echo strspn("Hello world!","kHlleo"); ?>Test and see‹/›
Output Result
5