--- Jim Wilson <[EMAIL PROTECTED]> wrote:
> > Lexical anonymous functions would be enough for me. If these proposed
> > lexical anonymous functions could automagically bind themselves
> > to an instance's $this when called from within an object's scope (so as to
> act
> > as virtual methods), that would be grand.
>
> I agree - I don't need closures, but anonymous functions would be great.
>
> Perhaps a very minor point, but using create_function requires that the code
> is an executable string. From a maintainability standpoint, this is a
> little weird since it won't be syntax-highlighted etc. (Again, very very
> minor).
>
> Question: If lexical anonymous functions were added, could this be used with
> preg_replace and the 'e' modifier?
>
> So instead of:
> preg_replace('/some_pattern/e', 'base64_encode($0)', $someVar);
>
> We could use:
> preg_replace('/some_pattern/e', function ($matches) {
> return base64_encode($matches[0]);
> }, $someVar);
>
> I'd love this.
Check out preg_replace_callback(), it should free you from the /e modifier.
- Peter
Send instant messages to your online friends http://au.messenger.yahoo.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php