PHP strpbrk() Function
The strpbrk()
function is used to search a string for any of the set characters. It returns the rest of the string from where it found the first occurrence of givn string.This function is case-sensitive.
Syntax
strpbrk(string,charlist)
- String - (Required) Specify the First string to search.
- charlist - (Required) Specify the character to find.
Example
<?php echo strpbrk("Good Morning!","o"); ?>
Output
ood Morning!
Example
<?php echo "M will output: " . strpbrk("Good morning!","M"); echo "<br>"; echo "m will output: " . strpbrk("Good morning!","m"); ?>
Output
M will output: m will output: morning! This function is case-sensitive ("M" and "m" will not output the same).