Current Location: Home> Function Categories> strpbrk

strpbrk

Find any one of a set of characters in a string - Return a substring that starts with the found character
Name:strpbrk
Category:String
Programming Language:php
One-line Description:Find any character of a set of characters in a string.

Definition and usage

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.

Example

Example 1

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

Example 2

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

grammar

 strpbrk ( string , charlist )
parameter describe
string Required. Specifies the string to search.
charlist Required. Specifies the characters to be searched.
Similar Functions
Popular Articles