Return the portion of a string before the first occurrence of a character in PHP [duplicate] November 28, 2022 by Tarik For googlers: strtok is better for that: echo strtok("The quick brown fox", ' ');