On Thu, Sep 7, 2017 at 2:13 PM, David Rodrigues <david.pro...@gmail.com> wrote: > I understand that array_filter() should costs more than for/foreach because > it is a function call that call another function for each item, while the > for/foreach is a language constructor that works on a way totally different > and its optimized for this kind of job. > What you're describing is called inlining. At the moment, the main barrier to inlining is the symbol scopes.
1. Any variables used within the closure must not collide with the calling scope unless: 1.a: The value is captured by ref, or 1.b: The value has been captured by val and is reset between invocations. 2. Variables within the closure must destruct at the end of each invocation (loop). If you're seriously interested, I'd recommend prototyping an optimizing using the zend_ast_process hook. -Sara -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php