Den fre. 26. okt. 2018 kl. 17.43 skrev Larry Garfield <[email protected]>: > I believe the proposal for short lambas (which should get resurrected at some > point) would handle this case well enough as well as help a dozen other > things. To wit: > > array_filter($names, |$x| ==> trim($x))
I still fail to see why it would be considered to have that over a perfectly encapsulted string for a callback, using a lambda/closure is just an extra runtime call for syntax sugar, that seems poor in my eyes. What would be ideal here, would be for functions to be first class citizens in callback contexts, like in C to avoid the quotation, however it clashes with constants. A hack you can do in userland could be something like: const trim = 'trim'; array_filter($names, trim); -- regards, Kalle Sommer Nielsen [email protected] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
