PHP extract values from multidimensional array without a loop -
i'm wondering if it's possible extract values array, in php, without having loop through. here's part of array know mean;
array ( [0] => array ( [0] => 76 [1] => adventures of huckleberry finn ) [1] => array ( [0] => 65 [1] => adventures of huckleberry finn ) [2] => array ( [0] => 59 [1] => bookcases ) )
i'm after integer [0] each array - there function can quicker foreach loop (the way this) ?
thanks.
you looking array_walk()
$newarray = array(); $mycallback = function($key) use(&$newarray){ $newarray[] = $key[0]; }; array_walk($myarray, $mycallback);
this of course if had array above in variable $myarray
Comments
Post a Comment