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 Quote Link to comment Share on other sites More sharing options...
trq Posted July 7, 2010 Share Posted July 7, 2010 explode. Quote Link to comment 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; } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
jmcc Posted July 8, 2010 Author Share Posted July 8, 2010 Hi thanks that worked perfect. Jay Quote Link to comment 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.