php - How can all keys and values of an array and make them in there own array? -


let array looks this:

array (     [0] = charcoal,natural gas,combo     [1] = charcoal,propane,combo     [2] = charcoal,propane,natural gas,combo     [3] = natural gas ) 

what make this:

array (     [0] = charcoal,natural gas,combo ) array (     [0] = charcoal,propane,combo ) array (     [0] = charcoal,propane,natural gas,combo ) array (     [0] = natural gas ) 

at first glance suggest this:

$array = array (     [0] = charcoal,natural gas,combo     [1] = charcoal,propane,combo     [2] = charcoal,propane,natural gas,combo     [3] = natural gas ); $array2 = array(); foreach ($array $item) {     $array2[][] = $item; } 

on second thought instead of showing new array of how want like, show me multiple arrays. mean implementation this:

foreach ($array $item) {     print_r($item); } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -