jmcc Posted July 7, 2010 Share Posted July 7, 2010 Hi How do I insert csv into array. Example $var = 111,222,333,444,555,666,777,888,999; How do I insert those values into an array-> array('111','222','333','444','555','666','777','888','999'); Thanks Jay Link to comment https://forums.phpfreaks.com/topic/207081-how-do-i-get-values-seperated-by-commas-into-array/ Share on other sites More sharing options...
trq Posted July 7, 2010 Share Posted July 7, 2010 explode. Link to comment https://forums.phpfreaks.com/topic/207081-how-do-i-get-values-seperated-by-commas-into-array/#findComment-1082789 Share on other sites More sharing options...
jmcc Posted July 8, 2010 Author Share Posted July 8, 2010 Something like this? $var = 111,222,333,444; foreach($var as $num) { list($phone[]) = explode(',',$num); echo $num; } Link to comment https://forums.phpfreaks.com/topic/207081-how-do-i-get-values-seperated-by-commas-into-array/#findComment-1082793 Share on other sites More sharing options...
kenrbnsn Posted July 8, 2010 Share Posted July 8, 2010 No, <?php $var = '111,222,333,444,555,666,777,888,999'; $arr = explode(',',$var); ?> Ken Link to comment https://forums.phpfreaks.com/topic/207081-how-do-i-get-values-seperated-by-commas-into-array/#findComment-1082796 Share on other sites More sharing options...
jmcc Posted July 8, 2010 Author Share Posted July 8, 2010 Hi thanks that worked perfect. Jay Link to comment https://forums.phpfreaks.com/topic/207081-how-do-i-get-values-seperated-by-commas-into-array/#findComment-1082797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.