how to remove first word from a php string

Monkeyalan picture Monkeyalan · Jul 26, 2011 · Viewed 30.5k times · Source

I'd like to remove the first word from a string using PHP. Tried searching but couldn't find an answer that I could make sense of.

eg: "White Tank Top" so it becomes "Tank Top"

Thanks

Answer

amosrivera picture amosrivera · Jul 26, 2011

No need for explode or array manipulation, you can use function strstr:

echo strstr("White Tank Top"," ");
//Tank Top

UPDATE: Thanks to @Sid To remove the extra white space you can do:

echo substr(strstr("White Tank Top"," "), 1);