jmurch Posted March 16, 2007 Share Posted March 16, 2007 I have a string 'firstword - secondword' that I want to split into two variables so that $var1 = firstword and $var2 = secondword. The '-' will always be the delimeter. Thanks Quote Link to comment Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 $string = "firstword - secondword"; $words = split(" - ", $string); foreach ($words as $word) { print $word . "<br />"; } Quote Link to comment Share on other sites More sharing options...
shaunrigby Posted March 16, 2007 Share Posted March 16, 2007 <?php $exploded = explode(" - ",$string); ?> The values will be stored in an array Quote Link to comment Share on other sites More sharing options...
jmurch Posted March 16, 2007 Author Share Posted March 16, 2007 Thanks guys................. 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.