solon Posted December 18, 2008 Share Posted December 18, 2008 Hey guys i need to seperate a string of numbers i.e $var1 = "43 56 88 02 66 21"; i need a way to separate those numbers after the space! so the result of the function should be an array with the values as follows: $arr[0] = "43" $arr[1] = "56" $arr[2] = "88" $arr[3] = "02" $arr[4] = "66" $arr[5] = "21" Thanks in advance for any help Quote Link to comment https://forums.phpfreaks.com/topic/137510-solved-php-split-a-string/ Share on other sites More sharing options...
RichardRotterdam Posted December 18, 2008 Share Posted December 18, 2008 you can use explode to put the entries in an array $var1 = "43 56 88 02 66 21"; $arr=explode(" ",$var1); Quote Link to comment https://forums.phpfreaks.com/topic/137510-solved-php-split-a-string/#findComment-718597 Share on other sites More sharing options...
solon Posted December 18, 2008 Author Share Posted December 18, 2008 Thank you very much Quote Link to comment https://forums.phpfreaks.com/topic/137510-solved-php-split-a-string/#findComment-718606 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.