strpbrk
Find any one of a set of characters in a string - Return a substring that starts with the found character
strpbrk()
function searches for any of the specified characters in the string.
Note: This function is case sensitive.
This function returns the rest of the beginning of the specified character's first occurrence. If it fails, FALSE is returned.
Search for the character "Sh" in the string and return the remaining part of the string starting from where the specified character first appears:
<?php echo strpbrk ( "I love Shanghai!" , "Sh" ) ; ?>
Try it yourself
This function is case sensitive (the output of "S" and "s" are not the same):
<?php echo strpbrk ( "I love Shanghai!" , "S" ) ; echo "<br>" ; echo strpbrk ( "I love Shanghai!" , "s" ) ; ?>
Try it yourself
strpbrk ( string , charlist )
parameter | describe |
---|---|
string | Required. Specifies the string to search. |
charlist | Required. Specifies the characters to be searched. |