4 ms·
PHP as a programming language is... okay. And it has come a long way in recent years to become "okay". But frankly, wasting another keystroke regurgitating to t
by kingdomcome50 6y ago
PHP as a programming language is... okay. And it has come a long way in recent years to become "okay". But frankly, wasting another keystroke regurgitating to tired old "PHP sucks" trope would be to completely miss why PHP is so great (hear me out).
PHP as a development paradigm is second to none. The reason to choose PHP isn't because it is such a great language, the reason to PHP is because it gives you the most power for the least effort compared to any platform targeting the web (fight me).
PHP is dead simple. I can make a new directory with a single index.php file and view it in my browser in less than 10 seconds. I can then change/add more files, hit F5, and immediately see those changes reflected on my screen. It is the tightest feedback loop possible. I didn't have to remember/rely on any CLI helpers or package managers or debug tools. I didn't have to redeploy or recompile or restart anything... none of the bullshit. Just one file in one directory with zero indirection. And we aren't even done yet!
PHP also gives you a built-in web framework out of the box. It automatically parses server/request information and hands it to me for processing into a response. What's that? I don't need a special templating engine to format my output nicely either? PHP is a templating engine! Did I mention routing is also built-in (and transparent) as well?
The above is why PHP has become so popular/beloved by so many (and hated by many more). Everyone complaining about the language features ("array doesn't work the way I want it to!") is simply putting their ignorance on full display. There is nothing wrong with wanting something else out of your development environment/paradigm (heck, I've moved on too!), but don't blame PHP because it doesn't conform to your idea of how an application should be written.
The above is also why I am so disappointed by the direction the PHP community seems to be taking the language. I am all for improving PHP as a language, but to be honest, I have a feeling the maintainers are going to prove all of those people that claim "PHP is just a worse Java" right... PHP will never be as powerful of a language as Java or C#, and for the reasons I explain above, it doesn't matter! Nobody is choosing PHP because of the language (if they were, they would have chosen Java/C# in the first place).
If you want to improve PHP, improve upon the things that make it great. Lean in to templating. Lean in to a more functional approach. Lean in to includes. Screw it, add some more magic! Make the platform more ergonomic. It was always the draw anyway. Who cares about the language...