Assuming that the callback function(s) that I am using have a time complexity of O(1), what is the running time of the array_filter function in PHP and is there somewhere I can find the implementation of the array_filter function?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The source of array_filter is in here, C-f for array_filter:
https://github.com/php/php-src/blob/master/ext/standard/array.c
I found the answer (which states that array_filter is O(n), not entirely unobvious seeing it needs to iterate over every item in the list exactly once):
List of Big-O for PHP functions