<?php
$search = array(1, 2, 0, 4);
$callback = function($number) {
return ($number == 0);
};
function searchByCallback($array, callable $c) {
foreach($array as $value) {
if ($c($value)) {
$filter[] = $value;
}
}
return $filter;
}
$searched = searchByCallback($search, $callback);
PD9waHAKJHNlYXJjaCA9IGFycmF5KDEsIDIsIDAsIDQpOwoKJGNhbGxiYWNrID0gZnVuY3Rpb24oJG51bWJlcikgewoJcmV0dXJuICgkbnVtYmVyID09IDApOwp9OwoKZnVuY3Rpb24gc2VhcmNoQnlDYWxsYmFjaygkYXJyYXksIGNhbGxhYmxlICRjKSB7CgkkZmlsdGVyID0gYXJyYXkoKTsKCglmb3JlYWNoKCRhcnJheSBhcyAkdmFsdWUpIHsKCQlpZiAoJGMoJHZhbHVlKSkgewoJCQkkZmlsdGVyW10gPSAkdmFsdWU7CgkJfQoJfQoKCXJldHVybiAkZmlsdGVyOwp9Cgokc2VhcmNoZWQgPSBzZWFyY2hCeUNhbGxiYWNrKCRzZWFyY2gsICRjYWxsYmFjayk7CgpwcmludF9yKCRzZWFyY2hlZCk7