4 ms·
Sometimes I really wonder, why everyone hates PHP? Sure, it's not the best language around to do complex calculations but it's very easy to write code there.
by MarioSh 12y ago
Sometimes I really wonder, why everyone hates PHP? Sure, it's not the best language around to do complex calculations but it's very easy to write code there.
- McGlockenshire 12y agoIt's not a particularly elegant language. Even with the RFC process, php-internals still resists adding language features useful only to advanced developers. The standard library is full of warts, including odd spelling, inconsistent argument order, etc. The killer though, as mentioned in the article, it has a low barrier to entry, so lots of neophytes write lots of bad code in it. There's also a tremendous amount of horrid, obsolete code out there, written by people that didn't know any better at the time, and kept up because the internet never forgets. PHP is far less of a joke than it used to be, but people will continue to hate on it and look down on people that make a living writing it.
- wvenable 12y agoThe thing that gets me is that JavaScript has all these same problems yet, because everyone is forced to use it, it doesn't get as much hate.
- McGlockenshire 12y agoAnother major difference is that Javascript has trendy things with hype machines. PHP is not trendy, and there's pretty much no hype around any PHP project.
- TheAnimus 12y agoIt's not the hype, for me I use JavaScript because I have no choice. I dislike many things about it, but I have no choice, I need my code to run in the web browser, no plug in, no Flash or Silverlight etc. For my start up, I can't see a single reason why we'd use PHP, try to not think of it as me saying PHP is bad, it's just other languages and frameworks offer us more value.
- wvenable 12y agoJavaScript is creeping into more places too; I'm going to be starting a project in JS soon because it needs to run the JavaScript sandbox provided by mobile OS's. And that is specifically to get around platform restrictions involving downloaded code and to make it easily cross-platform. If I had the choice, I'd use something else. So this also leads to using node.js (for early development and testing).
- Sanddancer 12y agoIt's easy to write code until you run into situations where you need more than a web framework. Got to run a job at midnight to pull in a daily dataset? You're probably gonna be heading for the python book, or the ruby book, etc, to actually get the work done. Even in big companies that "use" php, I'd be willing to wager a significant portion of their actual runtime is written in C and the like as extensions, because PHP the language is so slow. This isn't even getting into problems with the runtime itself. PHP's treatment of every new request by giving it a brand new instance to run in slows things down considerably, because it has to do so much startup work -- creating database connections, etc -- before it can get going. Personally, PHP's ugliness is a death from a thousand papercuts sort of situation. Yes, no one feature is a killer, but all the little quirks add up to a language that is less useful and productive after a while.
- wvenable 12y ago> Got to run a job at midnight to pull in a daily dataset? You're probably gonna be heading for the python book, or the ruby book, etc, to actually get the work done. Nope. PHP has no problem with running jobs. Mixing code-bases for this kind of thing would be a bad idea. > because PHP the language is so slow. That is definitely true but you're still waiting more on IO than the language itself. So really, most people aren't use C extensions. > PHP's treatment of every new request by giving it a brand new instance to run in slows things down considerably, because it has to do so much startup work -- creating database connections, etc -- before it can get going. Database connections are pooled, of course. Byte code is cached. In my case, PHP doesn't even touch the disk when it loads -- all the compiled byte code is in RAM. Instances of PHP are pooled with Apache children as well. And, of course, you can run PHP just like you run Ruby and Python without about the same amount of configuration of the web server. > Personally, PHP's ugliness is a death from a thousand papercuts sort of situation. Most of PHP's ugliness is legacy stuff (badly named functions, etc) that are pretty much old news and hardly restricting.
- V-2 12y agoThat is an evergreen piece that answers your question: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ If that doesn't convince someone that PHP isn't a pleasant language I don't think anything will. (Its business value is another matter - that McDonald's is extremely successful doesn't mean their food is top quality...)