On Sat, Sep 26, 2015 at 12:31 PM, Levi Morrison <le...@php.net> wrote: > On Sat, Sep 26, 2015 at 11:07 AM, Rowan Collins <rowan.coll...@gmail.com> > wrote: >> On 26/09/2015 17:17, Levi Morrison wrote: >>> >>> What concerns do you have about `fn($x) => $x * 2` or `function($x) => >>> $x * 2`? I will be writing a proper RFC later but I wanted to get >>> discussion going now. >> >> >> If a keyword is required next to the parameters, having the => as a separate >> token looks a bit weird. It no longer matches other languages, so how about >> thinking a bit further outside the box? > > Thank you for the feedback. I feel like the rest of what you proposed > was a bit too far outside of the box. For what it is worth no token > after the paren is necessary – you could do `fn($x) $x * 2` (or > `function($x) $x * 2`). I think this is a case where more syntax > helps.
Here they are on separate lines so you can see things more clearly: $output = array_map(function($x) $x * 2, $input); $output = array_map(function($x) => $x * 2, $input); I think the arrow helps. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php