php strspn() function
Translation results:
英[strɪŋ] 美[strɪŋ]
n.String; rope, belt; thread, plant fiber; [Computer Science] String
vt. Winding, tuning; To line up in a line or a series; to tie, tie or hang with a thread; to extend or extend
Third person singular: strings Plural: strings Present participle: stringing Past tense: strung Past participle: strung
php strspn() functionsyntax
Function: Return the number of certain characters contained in the string
Syntax: strspn(string,charlist,start,length)
Parameters:
Parameters | Description |
string | Required. Specifies the string to be searched for. |
charlist | Required. Specifies the characters to search for. |
start | Optional. Specifies where in the string to begin. |
length | Optional. Defines the length of the string. |
Description: Returns the number of characters specified in the charlist parameter contained in the string.
php strspn() functionexample
<?php echo strspn("Hello world!","kHlleo"); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
5
<?php echo strspn("PHP is a good development language! I love PHP","PHP"); ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
3