|
|
|
|
|
by jtreminio
5143 days ago
|
|
Define competitive? I didn't realize all languages were in a competition to be... what? The best? I write in PHP not because it is my hobby, but because I know it very well and it makes me a lot of money. The companies I work for use PHP because they can find many talented developers. Using a proper framework, being very strict about unit testing, and following other best practices makes our codebase a joy to work with. I'm sorry if you feel this isn't possible with PHP, but my point of elitism still stands. Who cares if PHP isn't "competitive", whatever that means? It works, we can create applications that are used by thousands of people a day to do important things (online education in my case), and most of all it brings in money. |
|
I used PHP professionally for almost four years, at places like Flickr and Wikipedia. It definitely packs a lot of power - it's fast at what it does, has every library you probably want built in already or available with a little config. And, out of the box, it matches the request-response loop in web programming much more simply than most languages do.
Unfortunately, even with these good qualities, PHP just has a lot of misdesign in it. It's not elitism to point this out.
Just look carefully at your own practices and you'll see that a lot of what you do is defending yourself against bad practices that PHP is subtly (or unsubtly) trying to impose on you. It's telling that PHP is a template language, but in order to achieve useful results, you really have to use another template language on top of it, like Smarty or Symfony or whatever the cool thing is these days. And even so, to this day, Rasmus thinks that such frameworks are misguided, and that real programmers should just use the built-in templating of PHP (i.e. embedding blocks of code in HTML) and nothing else. How anyone can work for over 15 years on the web and still think this is beyond me.
For most of its existence PHP's only guiding principle was expediency and one-off hacks. That's how you get a 'feature' where you can inject evil values into the script just by parsing CGI arguments. Or, the ability to just ignore errors by prepending an at sign. This is almost NEVER a good idea, and introducing a feature like that means that in any large project you never can be sure what's really going on, without actually looking for all instances of this all the time.
And what kind of language makes a keyword like 'array()'? PHP is a supposedly dynamic language, but it almost goes out of its way to make manipulating complex data structures difficult. Compare to Perl and Python, which make deep data structures easy and also easy to transform and manipulate. Instead PHP has insecure, hacky misfeatures like variable variable names. This is something that beginner programmers often want, until they learn about actual data structures.
I have a feeling you may not be all that familiar with other languages, or for that matter, PHP. There are experts who choose PHP, but they acknowledge these difficulties.