Array PHP de filtro de objetos
//Array_filter to filter employee whose salaries are more than 12,000.
$filtered_arr = array_filter($employees_arr,function($employee){ return $employee->get_salary() > 12000;});
//Gets the filtered array.
print_r($filtered_arr);
/*
OUTPUT
Array
(
[0] => Employee Object
(
[id] => 1
[name] => Rachel
[salary] => 15000
)
[1] => Employee Object
(
[id] => 2
[name] => Anna
[salary] => 14000
)
[2] => Employee Object
(
[id] => 3
[name] => Robert
[salary] => 13000
)
)
*/
Singh99