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 −

Live Demo

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

Output

yalam

Example

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

Live Demo

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

Output

ext

Updated on: 30-Jul-2019

149 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements