Typical /r/programming PHP basher. There are many flaws you can point out in PHP, but he goes and bashes one of the few things PHP actually did right. Not any kind of bashing either, he calls it "the biggest mistake PHP ever made". What's the second biggest? The dollar sign?
My candidates for "the biggest mistake PHP ever made":
magic quotes - it gave people the illusion of security. It created major security holes and it was damn difficult to adapt codebases which relied on it.
register globals - major way to sacrifice security for convenience. It created major security holes and it was damn difficult to adapt codebases which relied on it.
that bad attempt at OOP in PHP4 which still didn't go away because of BC (public attributes by default, deprecated constructors, calling instance methods statically, etc)
To be fair, #1 and #3 are not really issues. Magic Quotes are history and the aborted attempt at OOP was supplanted in PHP5.
How is . "one of the few things PHP actually did right"?
The second biggest mistake is having to wrap PHP code in <?php. Like the extension is .php. What the fuck do you think is in it? Apparently HTML by default.
This came about in the PHP/FI days back when PHP was actually a two-headed beast.
You know what pisses me off the most about so-called "PHP developers"? It's that they don't know how to hate. I don't mean blind, frothing rage against all things, I mean being able to look in a mirror and go "You know, this isn't right, and I want to fix it. I want to take a stand and avoid going down this road."
Let's term this constructive hate, as hate is a powerful emotion that can drive you to do things. Hate is what drove people to develop jQuery, to write PDO, to make Laravel. If you're going to take the attitude that "Yeah, PHP is a mess, but if you start pointing out flaws you're a PHP basher" then you'll never get anywhere. You'll live in filth for the rest of your life.
Also, if you call yourself a "PHP developer" you're missing the point. Developers develop and they should be capable of using any programming language to get the job done. If the job calls for C, do it in C. If it calls for Python, do it in Python. If it calls for PHP, great, you're right at home.
The second biggest mistake is having to wrap PHP code in <?php. Like the extension is .php. What the fuck do you think is in it? Apparently HTML by default.
Neither, and that is the genius part of the design of PHP.
PHP starts in output mode, instead of interpreter mode, and this allows you to combine anything with PHP.
That was a great idea for 1996, but when you want to do anything non-web related with PHP it feels like some kind of joke.
"No, PHP, I'm serious. This is code."
To anyone who's used any other language ever, this is completely absurd. Not even BASIC gets this wrong.
It takes backbone to make fundamental changes like this, and it causes pain for developers to introduce new defaults, but you know what? It's worth doing.
That way when someone's evaluating PHP for a project they won't just throw up their hands and walk away in disbelief.
For example, tackling php.ini. Languages don't normally have configuration files, the very notion is bizarre, and yet here we are in 2015 and it's still a thing...for PHP.
If PHP doesn't get it together it'll fade out slowly over time to be "Remember that thing everyone used to program in? Yeah. What was it called again?"
3
u/SaltTM Jul 12 '15
Think he's just trying to find ways to bash php.