PHP strpbrk()Functions

PHP String 参考手册PHP String Reference Manual

Examples

Search a string for the characters "oe" and return the rest of the string starting from the position of the first occurrence of the specified character:

<?php
echo strpbrk("Hello world!","oe");
?>

Run Example »

Definition and Usage

The strpbrk() function searches a string for any of the specified characters.

Note:This function is case-sensitive.

This function returns the rest of the string starting from the first occurrence of the specified character. If not found, it returns FALSE.


Syntax

strpbrk(string,charlist)

Parameter Description
string Required. Specifies the string to be searched.
charlist Required. Specifies the characters to look for.

Technical Details

Return value: Returns the string starting from the searched character. If not found, it returns FALSE.
PHP version: 5+


More Examples

Example 1

This function is case-sensitive ("W" and "w" output the same):

<?php
echo strpbrk("Hello world!","W");
echo "<br>";
echo strpbrk("Hello world!","w");
?>

Run Example »


PHP String 参考手册PHP String Reference Manual Other Extensions