Computer >> Computer tutorials >  >> Programming >> PHP

strpbrk() function in PHP


The strpbrk() function is used to search a string for a specific character.

Syntax

strpbrk(str, charlist)

Parameters

  • str − The string to search

  • charlist − The characters to find

Return

The strpbrk() function returns a string starting from the character found, or false if it is not found.

Example

The following is an example −

<?php
   echo strpbrk("malayalam", "yk");
?>

Output

yalam

Example

Let us see another example to learn about the case sensitivity feature of the function −

<?php
   echo strpbrk("DEMO Text", "epl");
?>

Output

ext