Home / PHP Tips Generated By ChatGPT / Checking If a String Starts With a Specific Text in PHP PHP 8 introduced str_starts_with() for this purpose. Source Code if (str_starts_with('Hello, World!', 'Hello')) { echo "String starts with 'Hello'."; }