sager29 Posted August 19, 2010 Share Posted August 19, 2010 Is it possible to split a variable into 2 variables? /// I have this sentence $item = "Below Telegraph Hill, Smallwork Canvas Edition"; /// And I want to be able to do this $item = "Below Telegraph Hill" ; $medium = "Smallwork Canvas Edition"; Is it possible to find the comma in a string, and remove the comma & everything before or after it? Any recommendations would be appreciated. Quote Link to comment Share on other sites More sharing options...
teng84 Posted August 19, 2010 Share Posted August 19, 2010 /// I have this sentence $item = "Below Telegraph Hill, Smallwork Canvas Edition"; list($var1,$var2)= explode(',',$item); echo $var1; echo $var2; Quote Link to comment Share on other sites More sharing options...
sager29 Posted August 19, 2010 Author Share Posted August 19, 2010 Works perfectly. Thanks, just saved me hours of time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.