Programmer Question
PHP create an array ($arr2) from the values of another arrays ($arr1) key (name)?
I have an array as follows:
$arr1 = array(0 => array('name' => 'tom', 'age' => 22), 1 => array('name' => 'nick', 'age' => 18));
However I want to create an array from it which consists of all the names, so it would become:
$arr2 = array('tom', 'nick');
I've looked at array_filter(), but that would'nt work as this is a multi-dimensional array?
All help is appreciated :)
Find the answer here
No comments:
Post a Comment