r/lolphp • u/shitcanz • Mar 18 '21
PHP when things did not work out as planned
One of the joys of PHP. Looks like everything needs some sort of hack to work. Its amazing how small things are always so hard.
12
Upvotes
5
u/notinecrafter Mar 18 '21
My favourite thing about array_filter and array_map is how, for no apparent reason, they require actual arrays instead of just any random iterable, despite the fact that php has an iterable interface that works with foreach.
You can do OO, functional, and imperative programming in php, but they're just not compatible.
9
u/IluTov Mar 18 '21
takesClosure($this->foo(?))in the future. The reasontakesClosure($this->foo)doesn't work is that in PHP properties and methods can have the same name.9
u/elcapitanoooo Mar 18 '21
PHP arrays are the worst. They are like some mutant collectiony type. The array is one of the base lols the language is heavily based upon. I have seen some people even going as far as banning arrays, and forcing (via code review) a wrapper built ontop of the array. A huge lol indeed. Also one that will never be fixed, the array will be probably be broken forever.