Videos
PHP tends to get a lot of flak, but mostly it is for something that isn't really the fault of PHP.
Things like "there is so much bad PHP code out there" may be true but you can write bad code in any language. You shouldn't be mixing PHP, SQL and HTML, and you should be escaping/parameterizing variables for queries. (Thankfully this is less prevalent nowadays.)
So do many PHP criticisms actually hold true today, now we have namespaces and we have buried crap like magic quotes at the bottom of the ocean?
Edit: Wow, a lot of responses! It seems like inconsistent function naming/parameter ordering is the biggest gripe. If that's really the worst problem with PHP then I think we're pretty well-off.
Sorry if this is a shit post, but it's been bugging me for a while and I need answers. I really like working with PHP, but at every web development conference I go to it seems like it's a forgone conclusion that PHP is horrible to the point where presenters don't even mention it as a viable language to use to build web applications. I just got done with a day long event today and it was the same. Presenters wanted a show of hands of what we were using. "Python? Ruby on Rails? .NET? Scala? Perl? Anything else?" I raise my hand and say PHP and the presenter literally gave me condolences.
Seriously? How the hell is PHP not like the first or second option? With all the major sites and CMSs out there in PHP and Scala is mentioned before PHP??
I realize some technologies are easy to use poorly but I've found PHP to be absolutely great with a framework (I use Zend) for application development and fantastic for small scripts to help me administer my servers.
What am I missing here? I find it annoying and rude, especially considering how crucial PHP has been for the web.
Disclaimer: I am not here to rant or declare the superiority of a specific language/system/framework etc. all I want is to have a civil talk with other devs that may or may not have a different opinion. So please, don't turn the comment section into a warzone. Thanks
Hi, I am a somewhat new backend web developer that comes from a system programming/game dev background. When I was doing my research about which backend language should I choose, I found out about PHP and liked it. Other options wereJS-based Node.js which I didn't quite like. I am not a frontend dev so neither It's being a JS-based nor its other features didn't make me interested. After making a few projects with PHP, I started to like it even more. When talking to other web devs, reading articles, watching Youtube videos, or browsing programming memes (I know, it's not the best place to learn), It occurred to me that most people look like they hate PHP. So I researched about the reasons and most of them blame it for 'Bad Security' and I can't understand this point. People accused it because of having 'Potential XSS exploit' which could be solved by just feeding the input from the user to a function (htmlspecialchars()) It's like blaming a gun for killing an innocent person rather than its operator. I might have wrong information about this topic (Which is why I am writing this) so what are your views on this topic?
PHP has a low barrier to entry, is easy to learn, and very easy to write badly. PHP before version 5, the language itself, was rather badly designed.
Back in the day, tons of shitty PHP code was flying around. The only (but biggest) turd left from that era is WordPress, which is probably the single biggest factor in PHP's reputation at this point.
Personally my issues with PHP have nothing to do with the language. It's the jobs.
It seems weird to criticize a language for having successful projects built with it, but as a developer who has to work on these projects; that is the problem with PHP.
Most PHP jobs involve very old open source business software. Projects like WordPress, Drupal, OpenCart, or Magento. The thing almost all these have in common is being terrible to work on. They're super old codebases with all sorts of janky work arounds and hacks.
It's rare for there to be any sort of automated testing. You typically have less than ideal ops (these are often hosted on shared hosting and have no sort of CI / CD pipeline). Most of the custom business logic you will work on will involve hacking apart some plugin that does most of what you need to get the last 5% a client is requesting. These jobs also tend to be on the lower paying side as far as dev jobs go.
If you can find a job working on custom software in something like laravel or symfony, that has good test coverage, good CI / CD, and a great local dev environment; then PHP is great. But thats maybe 1 out of every 1000 PHP jobs.
On the flip side in something like ruby on rails almost every job will be like that.