strchr(string $haystack, mixed $needle, bool $before_needle = false): string|false
Returns the substring starting from the match point onwards, or returns FALSE if no match is found in the string.
$text = "Hello world, the world is great!";
$result = strchr($text, "world");
echo $result;
world, the world is great!
$text = "Hello world, the world is great!";
$result = strchr($text, "world", true);
echo $result;
Output
Hello
$text = "Hello world, the world is great!";
$result = strchr($text, "World");
echo $result ? 'True':'False';
Output
False
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.