Convert a multidimensional array in php -
below multidimensional array.the first index array data user, each sub array contain properties user i.e name, ideally want break array have such array below.
array ( [1] => array ( [0] => array ( [first name] => dahn ) [1] => array ( [event name] => testing out eventbrite php api ) [2] => array ( [last name] => king ) ) [2] => array........
the array want able generate such
array ( [0] => array ( [first name] => dahn [event name] => testing out eventbrite php api [last name] => king ) [1] => array (
thanks in advance. link or point me in right direction highly appreciated
try this:
<?php function convert($array){ $new = array(); foreach($array $arr){ $n = array(); foreach($arr $arr2){ foreach($arr2 $key => $val){ $n[$key] = $val; } } $new[] = $n; } return $new; } ?>
Comments
Post a Comment