PHP strpbrk() Function
Topic: PHP String ReferencePrev|Next
Description
The strpbrk() function searches a string for any of a set of characters, in a case-sensitive manner.
The following table summarizes the technical details of this function.
| Return Value: | Returns the portion of the string starting from the first matched character to the end of the string (including that character), or FALSE if no character is found. |
|---|---|
| Version: | PHP 5+ |
Syntax
The basic syntax of the strpbrk() function is given with:
The following example shows the strpbrk() function in action.
Example
Run this code »<?php
// Sample string
$str = "Rain, rain, go away";
// Searching string
echo strpbrk($str, "row");
?>
Parameters
The strpbrk() function accepts the following parameters.
| Parameter | Description |
|---|---|
| string | Required. Specifies the string to search in. |
| charlist | Required. Specifies a string containing the list of characters to search for. |
More Examples
Here're some more examples showing how strpbrk() function actually works:
The following example shows the case-sensitive behavior of this function, gives different output than the previous example, because this time charlist contains the uppercase letter "R".
Example
Run this code »<?php
// Sample string
$str = "Rain, rain, go away";
// Searching string
echo strpbrk($str, "Row");
?>

