|
-
May 13th, 2014, 05:26 PM
#1
Thread Starter
Fanatic Member
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'
-
May 14th, 2014, 06:36 AM
#2
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'
-
May 17th, 2014, 04:52 PM
#3
Hyperactive Member
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
-
May 17th, 2014, 10:38 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|