Slicing a multi-dimensional PHP array across one of its elements
问题 Say for example you just queried a database and you recieved this 2D array. $results = array( array('id' => 1, 'name' => 'red' , 'spin' => 1), array('id' => 2, 'name' => 'green', 'spin' => -1), array('id' => 3, 'name' => 'blue' , 'spin' => .5) ); I often find myself writing loops like this. foreach($results as $result) $names[] = $result['name']; My questions is does there exist a way to get this array $names without using a loop? Using callback functions count as using a loop. Here is a more