Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
One liner if might look a tad cleaner. return key_exists($v, $aTrasformaCampi) ? $aTrasformaCampi[$v] : $v;
-
Yeah, anonymous functions suck in PHP. But with modern PHP (7.1+ I guess) you can simply do it like this:
return $aTrasformaCampi[$v] : $v;
And PHP 7.4 will introduce arrow function syntax, so the entire thing will look like this:
$daa = array_map(fn ($v) => $aTrasformaCampi[$v] : $v);
Related Rants
I made my first closure in PHP, but I'm not happy.
For me Javascript closure are nicer.
What do you think about?
rant
php
javascript
closure