Latest web development tutorials

PHP strpbrk () function

PHP String Reference PHP String Reference

Examples

In the search for the character string "oe", and returns the remainder of the string from the first occurrence of a specified character position beginning:

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

Running instance »

Definition and Usage

strpbrk () function searches for any character in a specified string.

Note: This function is case-sensitive.

This function returns the character position of the first occurrence of the remaining portion began. If not found, it returns FALSE.


grammar

strpbrk( string,charlist )

参数 描述
string 必需。规定被搜索的字符串。
charlist 必需。规定要查找的字符。

technical details

return value: Returns a string of characters from the beginning to find. If not found, it returns FALSE.
PHP version: 5+


More examples

Example 1

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

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

Running instance »


PHP String Reference PHP String Reference