puiu91
12/1/2015 - 5:50 PM

PHP Reduce Array Level

PHP Reduce Array Level

<?php 

[0]
   [0] => 'something'
[1]
   [0] => 'something else'
   
// map method
$temp = array_map(function($a) {  
    return array_pop($a); 
}, $someArray);


// standard method
foreach ($someArray as $key => $value) {
    $temp[] = $value['id'];
}