Just because something has made tremendous improvements doesn't mean it's not laughably bad. There is no reason to write new applications with PHP in this day and age with the exception of protecting fragile egos of those who aren't willing to learn something better.
Settle down, Beavis. PHP's a tool. It does a certain kind of job. People are allowed to use it. Bitching about it is like bitching about a hammer. "You can't even screw in a screw with it!" Indeed.
Watching people use PHP is like someone grabbing a rock and bashing nails with it. Sure it's a tool, but you still look stupid using it to hammer things.
* implicit conversions
* arrays are passed by value (by default)
* poor performance
* dollar signs everywhere
* inconsistent function names
* horrendous standard library
* arrays are a mix of real arrays, hashmaps and other things
* it keeps executing even after encountering errors
Overall the langauge reduces my productivity, encourages bad code and doesn't even perform well.
Thank you for having some real concerns with the language.
Some of these are addressed in PHP7. Performance is increased significantly, and exception handling has gotten some major improvements as well.
The encouragement of bad code I disagree with though, you can write bad code in any language. It isn't up to the language structures to force the developer into a certain way of writing.
For typing issues, there are strict modes as well, and type checking is something that's being improved in PHP7 again.
That's been rebutted: http://forums.devshed.com/php-development-5/php-fractal-bad-...
There are valid criticisms of PHP but the common citation of that article as the end of the debate on PHP's strengths and weaknesses is a mistake, especially in light of PHP 7.
That rebuttal's use of WordPress as an example of PHP done right is not very convincing... Also, Facebook and Wikipedia uses HHVM instead of standard PHP
There it is. I was just waiting for that one fractal of bad design post from 2012 that everyone references in this argument, every time.
Cause, ya know, 4 years later there's probably nothing that is changed or improved. Better to just write it off completely than to do your own research and use relevant facts to shape an argument.
* It's 2016 and PHP still doesn't have a module system, Python had one in '91, Perl had one in '94, Ruby had one in '95
* inequality operators still have no === equivalent
* sorting is still indeterministic when you have null values because NULL < -1, and NULL == 0
* arrays are the only containers in the language and they simultaneously act as sets, lists, and associative arrays which fucks up almost all array functions because you don't know what they will do
* PHP has had exceptions for almost 10 years now and a lot of functions still require you to use their specific error function to tell if it failed. So if you don't call say json_last_error, your code will SILENTLY return the wrong thing
* It's 2016 and PHP still doesn't have a module system, Python had one in '91, Perl had one in '94, Ruby had one in '95
Composer is widely adopted and has been the standard for years now. It's not baked into the language, it's a community driven effort that has been wildly successful.
* inequality operators still have no === equivalent
Still true. Pretty easy to deal with since there are functions for handling equality of all scalar types.
* sorting is still indeterministic when you have null values because NULL < -1, and NULL == 0
> * arrays are the only containers in the language and they simultaneously act as sets, lists, and associative arrays which fucks up almost all array functions because you don't know what they will do
Both of these things are true. Neither of these things regularly snag me in my development, but like many other dynamic languages, they do need to be carefully designed for. Unit testing, strongly typed scalar vars (new in PHP7), or using SPL object data structures instead of language primitive help here.
* PHP has had exceptions for almost 10 years now and a lot of functions still require you to use their specific error function to tell if it failed. So if you don't call say json_last_error, your code will SILENTLY return the wrong thing
I can't think of a function I regularly use besides json_encode that has this problem.
Much of that article was originally a disagreement with the approach PHP generally takes and is subjective in the first place. I'm not trying to sway people's opinion to actually use PHP, I'm just saying that despite the worts it is a capable language with an incredibly positive and productive community. It's no longer the dumpster fire it once was.
Yep, an article from 2012 is totally accurate and nothing has happened since.
I'm not into php dev anymore, by any means, but glancing at the improvements that have come through lately, even i have to admit that there's been a massive leap from 5.3 or so.
or they leak memory. or a heavy request generates gc activity which impacts other requests.
i've seen site outages in large companies due to these sorts of bugs. multiple times. this is a major set of problems that you avoid by having a memory model that fits the domain (http services). php sort of did it by accident, but it works. BEAM gets this right as well.
Modern applications using composer for dependencies give you this error information for free by virtue of the fact that `composer install` will fail. Most (all?) PaaS solutions take this into account and install those extensions. I know heroku does, as dokku uses the heroku buildpack :)
This would be problematic for any programming language, though.
However, if you do want an elegant solution for your problem, may I recommend ruby-install[1] and the companion for easily changing between versions, chruby[2]. Alternatively, you could try RVM[3].
There are a couple more versions (one is even specifically designed for Windows), but I found ruby-install and chruby to be the most convenient ones for both personal and professional use.
I'm not trying to bash Ruby, but I haven't done any programming with it for about 6 years. I just want to get some web thing running on my home server, or get some gems installed for Compass or whatever (which to be fair is now a lot easier with bundler).
What I don't want to do is figure out how RVM works for the third time and how to install it globally instead of just for my user account so Apache site one can use one version and Apache site two can use another.
Everything in that world changes every year and if you're not keeping up it's a huge mess.
Well, compiling C11 with a compiler that only supports C98, or GNU-C "extensions" in contrast to vanilla C, but there's no runtime compatibility issues like with interpreted languages (if that is what you were getting at).
Also, there's the problem with platform portability (in terms of compiler "oddities", not system libraries) which I won't get into, because it's a hairy subject. :)
You know, berating a programming language, just because it's older and not considered kind of "cool" or in vogue, is a clear display of intellectual juvenility. Also, you might want to know about a word called "slacking" which is a very real phenomenon, especially at workplaces.
As per http://githut.info/, PHP is still third most used language on Github. Code produced in it is, not as buggy as it is in Python (if issues mostly contributes to bug reports, and not feature requests), the second most used language.
Comments
You should definitely quit your job if browsing reddit makes you look worse than writing code in PHP.
Hey look, it's someone who hasn't written any PHP since 2008!
Things have moved on. It's just another language.
Just because something has made tremendous improvements doesn't mean it's not laughably bad. There is no reason to write new applications with PHP in this day and age with the exception of protecting fragile egos of those who aren't willing to learn something better.
What features is it missing that make it such a challenge for you to write anything with it?
I have yet to see a substantial answer to that question, even with all the PHP bashing, of issues with PHP that actually matter in the real world.
That's because it's the wrong question. Adding features is easy. It's making them work well together that's hard.
Settle down, Beavis. PHP's a tool. It does a certain kind of job. People are allowed to use it. Bitching about it is like bitching about a hammer. "You can't even screw in a screw with it!" Indeed.
Watching people use PHP is like someone grabbing a rock and bashing nails with it. Sure it's a tool, but you still look stupid using it to hammer things.
Instead of using metaphors, just answer the question:
What makes PHP bad?
* implicit conversions * arrays are passed by value (by default) * poor performance * dollar signs everywhere * inconsistent function names * horrendous standard library * arrays are a mix of real arrays, hashmaps and other things * it keeps executing even after encountering errors
Overall the langauge reduces my productivity, encourages bad code and doesn't even perform well.
Thank you for having some real concerns with the language.
Some of these are addressed in PHP7. Performance is increased significantly, and exception handling has gotten some major improvements as well.
The encouragement of bad code I disagree with though, you can write bad code in any language. It isn't up to the language structures to force the developer into a certain way of writing.
For typing issues, there are strict modes as well, and type checking is something that's being improved in PHP7 again.
Why is PHP laughably bad?
There's nothing wrong with PHP.
People like to shit on PHP as it is a popular entry point for new web developers.
But I've seen just as awful code in other languages throughout my career so far. I wish people would drop this elitist attitude towards PHP.
There's lots wrong with PHP. http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
That's been rebutted: http://forums.devshed.com/php-development-5/php-fractal-bad-... There are valid criticisms of PHP but the common citation of that article as the end of the debate on PHP's strengths and weaknesses is a mistake, especially in light of PHP 7.
That rebuttal's use of WordPress as an example of PHP done right is not very convincing... Also, Facebook and Wikipedia uses HHVM instead of standard PHP
HHVM is a webserver that replaces the likes of Apache or nginx, it isn't a language.
Perhaps you're confusing HHVM with hack?
There it is. I was just waiting for that one fractal of bad design post from 2012 that everyone references in this argument, every time.
Cause, ya know, 4 years later there's probably nothing that is changed or improved. Better to just write it off completely than to do your own research and use relevant facts to shape an argument.
80% of the article is still true. The biggest:
* It's 2016 and PHP still doesn't have a module system, Python had one in '91, Perl had one in '94, Ruby had one in '95
* inequality operators still have no === equivalent
* sorting is still indeterministic when you have null values because NULL < -1, and NULL == 0
* arrays are the only containers in the language and they simultaneously act as sets, lists, and associative arrays which fucks up almost all array functions because you don't know what they will do
* PHP has had exceptions for almost 10 years now and a lot of functions still require you to use their specific error function to tell if it failed. So if you don't call say json_last_error, your code will SILENTLY return the wrong thing
Composer is widely adopted and has been the standard for years now. It's not baked into the language, it's a community driven effort that has been wildly successful.
Still true. Pretty easy to deal with since there are functions for handling equality of all scalar types.
Both of these things are true. Neither of these things regularly snag me in my development, but like many other dynamic languages, they do need to be carefully designed for. Unit testing, strongly typed scalar vars (new in PHP7), or using SPL object data structures instead of language primitive help here.
* PHP has had exceptions for almost 10 years now and a lot of functions still require you to use their specific error function to tell if it failed. So if you don't call say json_last_error, your code will SILENTLY return the wrong thing
I can't think of a function I regularly use besides json_encode that has this problem.
Much of that article was originally a disagreement with the approach PHP generally takes and is subjective in the first place. I'm not trying to sway people's opinion to actually use PHP, I'm just saying that despite the worts it is a capable language with an incredibly positive and productive community. It's no longer the dumpster fire it once was.
Yep, an article from 2012 is totally accurate and nothing has happened since.
I'm not into php dev anymore, by any means, but glancing at the improvements that have come through lately, even i have to admit that there's been a massive leap from 5.3 or so.
Not until you try to run it at least
Can you elaborate? I might have been having problems with PHP for 10 years without even knowing it didn't run!
php is one apt-get install away. Java, not so much (for example).
at least request contexts in http php apps are isolated; memory lives and dies per request, which is more than can be said for java web applications.
That is not a virtue. Java (And ruby, and python, and ASP.Net) get faster when they warm up.
or they leak memory. or a heavy request generates gc activity which impacts other requests.
i've seen site outages in large companies due to these sorts of bugs. multiple times. this is a major set of problems that you avoid by having a memory model that fits the domain (http services). php sort of did it by accident, but it works. BEAM gets this right as well.
That is a possible failure mode, but if it's standard practice in the systems you're touching you've had some bad luck?
apt-get install openjdk-6-jre-headless?
Sorry, I wasn't specific enough, I meant Java-based web apps^^
php based web apps are not 1 apt-get away either.
I don't know how many times I tried to run a php web app just to find out a random php5-* extension was missing, and then having to guess which one.
Modern applications using composer for dependencies give you this error information for free by virtue of the fact that `composer install` will fail. Most (all?) PaaS solutions take this into account and install those extensions. I know heroku does, as dokku uses the heroku buildpack :)
Or you know, anything with Ruby. Especially two things that need two different versions of Ruby!
This would be problematic for any programming language, though.
However, if you do want an elegant solution for your problem, may I recommend ruby-install[1] and the companion for easily changing between versions, chruby[2]. Alternatively, you could try RVM[3].
There are a couple more versions (one is even specifically designed for Windows), but I found ruby-install and chruby to be the most convenient ones for both personal and professional use.
[1] https://github.com/postmodern/ruby-install [2] https://github.com/postmodern/chruby [3] https://rvm.io/
...except PHP.
Exactly.
I'm not trying to bash Ruby, but I haven't done any programming with it for about 6 years. I just want to get some web thing running on my home server, or get some gems installed for Compass or whatever (which to be fair is now a lot easier with bundler).
What I don't want to do is figure out how RVM works for the third time and how to install it globally instead of just for my user account so Apache site one can use one version and Apache site two can use another.
Everything in that world changes every year and if you're not keeping up it's a huge mess.
How is it not problematic with PHP? It's just as problematic from my experiences (I work for a hosting company and we have various PHP setups).
Unless you install PHP with a certain prefix—which you can do for other languages—I don't see how PHP solves the problem.
C?
Well, compiling C11 with a compiler that only supports C98, or GNU-C "extensions" in contrast to vanilla C, but there's no runtime compatibility issues like with interpreted languages (if that is what you were getting at).
Also, there's the problem with platform portability (in terms of compiler "oddities", not system libraries) which I won't get into, because it's a hairy subject. :)
You know, berating a programming language, just because it's older and not considered kind of "cool" or in vogue, is a clear display of intellectual juvenility. Also, you might want to know about a word called "slacking" which is a very real phenomenon, especially at workplaces.
You can cycle through different languages
haha you're right! very nice. C# is tolerable.
Click on the language near the top of the page, and it will shift to another one.
As per http://githut.info/, PHP is still third most used language on Github. Code produced in it is, not as buggy as it is in Python (if issues mostly contributes to bug reports, and not feature requests), the second most used language.
Those statistics don't tell you much beyond how popular the language is.