Javascript: $square = $x => $x*$x;
PHP : $square = fn($x) => $x*$x;
Probably so that it works inside arrays: $a=[fn($x)=>$x*2,fn($x)=>$x*$x];
echo $a[1](5); // 25
Well, it also makes it a tad more readable, so I am ok with it.Since we are talking about new features of PHP: Does anybody else wish there were named parameters?
I think PHP is pretty complete. It is my favorite language and I don't really wish for anything added to it. Except for two things:
1: The named parameters of Python:
def paint(what,color='blue',tool='pen',layers=1)
...
paint('house',tool='brush')
2: The short object Syntax of Javascript: city={name: 'Berlin', population: 3748000}