if (count(array_filter($a, function($v) { return $v > $x; })))
f();
// or with intermediate steps
$tmp = array_filter(
$a,
function ($v) { return $v > $x; }
)
if (count($tmp))
f();
// or with array reduce instead
if (
array_reduce($a,
function($old, $item) { return $old or ($item > $x); }
)
)
f();
// Array reduce takes the old result $old, and
// applies $item (from $a) to the old result
// iteratively. We use the 'or' boolean operator
// to implement an 'any' operation.