Suppose I have the following multidimensional array (extracted from MySQL or a service):
array( array( [id] => xxx, [name] => blah ), array( [id] => yyy, [name] => blahblah ), array( [id] => zzz, [name] => blahblahblah ), )
Is it possible to get an id array in one "built-in" php function call? or one line of code?
I know about the traditional loop and get the value, but I don't need it:
foreach($users as $user) { $ids[] = $user['id']; } print_r($ids);
Perhaps some array_map() and call_user_func_array() can do the magic.
php
ifaour Nov 03 '11 at 12:01 2011-11-03 12:01
source share