TheChief Posted December 30, 2006 Share Posted December 30, 2006 Hey, I need help with putting the following into an array:"1, 45, 4642, 567" (no quotes)I need the above to be put into an array, so $array[0] = 1, $array[1]=45 and so on. The above text can contain more than 4 numbers...so loop will need to be used, and the number of commas counted. Id appreciate it if someone could help me, as I don't know anything mabout arrays.Thanks. Link to comment https://forums.phpfreaks.com/topic/32253-putting-text-into-an-array/ Share on other sites More sharing options...
trq Posted December 30, 2006 Share Posted December 30, 2006 [code]<?php $s = "1, 45, 4642, 567"; $array = explode(', ', $s);?>[/code] Link to comment https://forums.phpfreaks.com/topic/32253-putting-text-into-an-array/#findComment-149692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.