bsamson Posted November 20, 2009 Share Posted November 20, 2009 Hello. If I have a string in the this format: $models = "1603, 1802, 1527, 1782, 1817, 1598, 1666, 1781, 1970, 1939, 1889, 1762, 1761, 1885, 1821, 1827, 1857, 1921, 1942, 1756, 1930, 1414, 1856, 1920"; Now, an interesting thing about $models is that sometimes there will be only 1 model (ie: $models="1234"), and as you can see from above example it sometimes contains many ... but the constant is that it will always be in that format. Is there a quick function/script to store each of those numbers (ie: 1603) into an array? Any help would be GREATLY appreciated! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/182304-solved-string-manipulation/ Share on other sites More sharing options...
mikesta707 Posted November 20, 2009 Share Posted November 20, 2009 $models = "1603, 1802, 1527, 1782, 1817, 1598, 1666, 1781, 1970, 1939, 1889, 1762, 1761, 1885, 1821, 1827, 1857, 1921, 1942, 1756, 1930, 1414, 1856, 1920"; $array = explode(", ", $models); explode() Quote Link to comment https://forums.phpfreaks.com/topic/182304-solved-string-manipulation/#findComment-961996 Share on other sites More sharing options...
bsamson Posted November 20, 2009 Author Share Posted November 20, 2009 Thank you!!! It's been a while since I coded ... I knew it was a simple solution, but completely forgot about explode!!!! THANK YOU! THANK YOU!!! Quote Link to comment https://forums.phpfreaks.com/topic/182304-solved-string-manipulation/#findComment-962000 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.