PHP strcspn() function is utilized to get the amount of characters that happen between the begin of the main string and the first event of any character listed in the second string.
Syntax:
strcspn(string,char,start,length)
string : Required. Defines input string.
char : Required. Defines the characters .
start : Optional. Defines where in string to start
length : Optional. Defines the length of the string (how much of the string to search)
Note: This function is binary safe.
Example:
<?php
echo strcspn("Good Morning","r");
?>
The output will be:
7
Syntax:
strcspn(string,char,start,length)
string : Required. Defines input string.
char : Required. Defines the characters .
start : Optional. Defines where in string to start
length : Optional. Defines the length of the string (how much of the string to search)
Note: This function is binary safe.
Example:
<?php
echo strcspn("Good Morning","r");
?>
The output will be:
7
0 comments:
Post a Comment