I have an array as follows:
$arr1 = array( 0 => array( \'name\' => \'tom\', \'age\' => 22 ), 1 => array( \'name\' => \'nick\',
if you are using Laravel, then simply use array_pluck:
array_pluck
$arr2 = array_pluck($arr1 , 'name');