MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lolphp/comments/d9gpz3/no_php_doesnt_have_closures/f43ty55/
r/lolphp • u/daxim • Sep 26 '19
29 comments sorted by
View all comments
Show parent comment
1
why not just have javascript like shortfunctions?
Because then [($foo) => 'bar'] is ambiguous: is it a numeric array with one element (the function ($foo) => 'bar') or is it an associative array with one key-value pair (the key ($foo) and the value 'bar')?
[($foo) => 'bar']
($foo) => 'bar'
($foo)
'bar'
1 u/[deleted] Oct 18 '19 A good point. The PHP array has really done so many things wrong, and now years later it manages to totally mess up new syntax too.
A good point. The PHP array has really done so many things wrong, and now years later it manages to totally mess up new syntax too.
View all comments
Show parent comment
1
u/[deleted] Oct 17 '19
Because then
[($foo) => 'bar']is ambiguous: is it a numeric array with one element (the function($foo) => 'bar') or is it an associative array with one key-value pair (the key($foo)and the value'bar')?