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 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); 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 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
Archived
This topic is now archived and is closed to further replies.