PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function getSortedNames($array) { $newarray = []; foreach ($array as $item) { $names = array_values($item); $newarray[] = $names[0]; } sort($newarray); return $newarray; } $users = [ ['name' => 'Bronn', 'gender' => 'male', 'birthday' => '1973-03-23'], ['name' => 'Reigar', 'gender' => 'male', 'birthday' => '1973-11-03'], ['name' => 'Eiegon', 'gender' => 'male', 'birthday' => '1963-11-03'], ['name' => 'Sansa', 'gender' => 'female', 'birthday' => '2012-11-03'] ]; $t = getSortedNames($users); print_r($t);
Show:  
Copy Clear