<?php
$anonHeight = 169; //Рост Анона
$classmates = array(
'Антон' => 172,
'Семен' => 165,
'Лена' => 189,
'Иван' => 171,
'Петр' => 182,
'Сидор' => 176,
'Аня' => 180,
'Таня' => 179,
'Маня' => 171
);
$array = array_filter($classmates, function($classmate) {
if ($classmate > 169) {
return true;
} else {
return false;
}
});
var_dump($array);
- Output for 7.0.0 - 7.0.24, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- array(8) {
["Антон"]=>
int(172)
["Лена"]=>
int(189)
["Иван"]=>
int(171)
["Петр"]=>
int(182)
["Сидор"]=>
int(176)
["Аня"]=>
int(180)
["Таня"]=>
int(179)
["Маня"]=>
int(171)
}
preferences:
136.14 ms | 404 KiB | 175 Q