Example 1 — Find the First Matching Character
Look for the first "s" or "t" in a sentence.
<?php
$text = "This is a test";
$rest = strpbrk($text, "st");
echo $rest, PHP_EOL; How It Works
- Create a sentence to search.
- Pass the characters "s" and "t" as one string.
- PHP finds the earliest match: the lowercase "s" in "This".
- It returns everything from that point to the end.

