douzi6060 2012-10-07 12:08
浏览 175
已采纳

PHP中array_filter的时间复杂度

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

  • 写回答

2条回答 默认 最新

  • dongzai2952 2012-10-07 12:14
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?