Show all text after specific word in a string.
Hi,
I am trying to pull what ever text is after a certain part of a string. For example
$string = "Radio that plays Justin Timberlake";
I want it to display what ever text is after 'Radio that plays'
I am trying to get it to grab the artist.
Any ideas?
(P.S the string will always be a different artist, above is just an example'
Re: Show all text after specific word in a string.
Is "Radio that plays" constant? If so then you can use substr()
PHP Code:
$string = "Radio that plays Justin Timberlake";
$artist = substr($string, 17);
// This will include everything after Position 17... 'Justin Timerberlake'
Re: Show all text after specific word in a string.
You could also use the build in PHP function explode.
http://us1.php.net/explode
Re: Show all text after specific word in a string.
Explode wont work for this case... Explode required a delimiter... there is no usable delimiter in the text he provided.