Home >>PHP String Functions >PHP strpbrk() Function
PHP strpbrk() function is used to search a given string for any of the specified characters. It returns the remaining of the given string from where it found the first occurrence of any of the given specified character. It is case-sensitive.
Syntax:strpbrk($string, $charlist);
Parameter | Description |
---|---|
string | This is a required parameter. This parameter defines the string to search. |
charlist | This is a required parameter. This parameter defines the characters to find. |
<html> <body> <?php echo strpbrk("PHPTPOINT","TO"); // T occurs first ?> </body> </html>
<html> <body> <?php $str = "PHPTPOINT"; echo strpbrk($str,"T"); echo "<br>"; echo strpbrk($str,"t"); // it is case sensitive so no output. ?> </body> </html>