Repgahroll Posted November 21, 2009 Share Posted November 21, 2009 Hello there! I have the following list: apple,banana,pear|applejuice,bananajuice,pearjuice|applepie,bananapie,pearpie I can explode these to get: array[0] = apple,banana,pear array[1] = applejuice,bananajuice,pearjuice array[2] = applepie,bananapie,pearpie However, i want to get: array[0][0] = apple array[0][1] = banana array[0][2] = pear ... But i don't know how i can explode these items inside the array to get such result. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/182410-exploding-arrays-inside-array-list-separated-by-commas-and-vertical-lines/ Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 Something like this? $input = 'apple,banana,pear|applejuice,bananajuice,pearjuice|applepie,bananapie,pearpie'; $arr = explode("|", $input); foreach($arr as $k=>$v) { $arr[$k] = explode(",", $v); } Link to comment https://forums.phpfreaks.com/topic/182410-exploding-arrays-inside-array-list-separated-by-commas-and-vertical-lines/#findComment-962639 Share on other sites More sharing options...
Repgahroll Posted November 21, 2009 Author Share Posted November 21, 2009 Exact!! Thank you very much! Link to comment https://forums.phpfreaks.com/topic/182410-exploding-arrays-inside-array-list-separated-by-commas-and-vertical-lines/#findComment-962756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.