Kinn Julião wrote on 08/02/2016 16:05:
That's the nice thing about userland... you are giving them ability to
implement what they want!
`array_filter([...], 'is_int', ARRAY_FILTER_USE_KEY)` does the job as the
others... don't think having a new function would prevent this.

It does the job, but it is much less efficient in some cases than the foreach and return false case, as it must examine every element; it also has unnecessary memory overhead, creating a filtered list which exists only to be counted and thrown away; and an internal implementation could be optimised even further by exploiting the way the engine stores the array internally.

PHP is at this stage expressive enough that a large number of core functions could be rewritten in multiple ways using other core functions, but that doesn't automatically rule out adding more functions to core where it is useful to do so.

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to