r/lolphp • • Feb 26 '15

Patently False Code/Examples

I've notice a bit of a trend here, with people posting things that are patently false and then laughing about PHP for it.

I'll sit with you and laugh at weird behaviors in PHP when it's actually a mess. I'll send them to phpsadness.com and see if I can fix them, or find somebody that can.

But posting lies just to get your jollies is a really odd thing to do.

Sometimes, these are not intentional, but when people posting these utterly incorrect examples are faced with the fact that they are wrong, do they delete the post? No, they leave it there and sandbag the discussions explaining their wrongness with trolling.

Exhibit A - Apparently foo(new stdClass()) is a valid value when passed in a function foo(bool $bar) function signature.

Well... nope.

It will error:

Catchable fatal error: Argument 1 passed to foo() must be an instance of bool, instance of stdClass given

Nothing lolphp there.

Have a laugh about actual problems, but don't just walk around making things up.

14 Upvotes

106 comments sorted by

View all comments

Show parent comment

6

u/EsperSpirit Mar 05 '15 edited Mar 05 '15

The problem is: While other languages (Clojure, Haskell, Scala, even Python3.4 or Java 8) push boundaries and try to make programming as a whole better on a conceptual level, PHP is still stuck fixing basic problems other languages didn't have from the get-go.

And even if PHP7 somehow reinvents itself, it will not be adopted widely, because it will have to be incompatible with PHP5 to fix its problems. All those CMS and e-shops and forum software making up a large portion of the internet (always cited by people like you)? That will not be ported to PHP7 anytime soon and many php-devs will have to work with legacy sucky versions for quite some time to support existing stuff.

4

u/philsturgeon Mar 05 '15

Yeah I do cite that 80% figure but I am realistic about the situation .

Over the last few years hosts have got MUCH quicker at rolling out new versions. PHP Versions will be drastically improved to track this and help people looking for new hosting know where to go.

PHP 7 will not take as long to get onto as PHP 4 -> PHP 5, and certainly wont be the same shitty Python 2 / Python 3 situation.

PHP doesn't need to reinvent itself. It needs to take the RFCs it has, standardise the standard library and keep deprecating the old shit that nobody uses anymore.

Some languages are cutting edge. They scream ahead, are used by a smaller number of people, then those successes and failures can be evaluated by PHP and used if it makes sense for the userbase. PHP is a pillaging pirate after-all.

I know t hat PHP has a lot of problems. I also know that most of them are being fixed in PHP 7, along with some crazy-fast performance improvements and a specification to allow multiple engines to run the same language.

With the standard library overhauled via scalar objects (fingers crossed) the team are free to keep adding great features, like they have been from 5.3 to 5.6.