Search needle in_array using a user-defined comparison function
问题 After searching some question on SO about this issue I could only found this and this but both do not allow sending argument (AKA needle) to the search function but using pre-defined function and using array_filter . I search in_array documentation but found none. I want to have something like (as usort enable): function uin_array($haystack, $needle, $compareFunc) I manage to implement it with simple foreach loop: function uin_array($haystack, $needle, $compareFunc) { foreach($haystack as $e)