I'm trying to wrap my head around why so many developers down PHP development like it is a second class language?
Secondly, what are the better alternatives for web development?
I'm trying to wrap my head around why so many developers down PHP development like it is a second class language?
Secondly, what are the better alternatives for web development?
For further actions, you may consider blocking this person and/or reporting abuse
Latest comments (64)
PHP is the only language where I have seen development practices that are mind blowingly awful. I fully understand that you can write bad code in any language, but for some reason PHP devs manage to top any expectation of bad code one could have.
Let me give you 3 examples.
The
switchstatement (or equivalent) is available in many languages. It is fine to use. The paradigm is that you switch on a variable and each case is a constant. There are two languages I am aware of that do not enforce that constraint. javascript and PHP. There is only one language I have seen this constraint ignored. PHP. In multiple places in the code they usedswitch(true)and thecasestatements called functions. This was a well known company.Using comments as code. I was trying to use a CMS developed in house (different company to the one above, not well known) and I was trying to figure out how to change which the main page was. I had to change part of a comment. I realise this isn't a default part of the language, so I guess the dev must have felt really proud of themselves.
Drupal 7 breaks PHP's raison d'etre. In my opinion PHP is a templating language for HTML. That's the best you can hope for it. Drupal 7 (maybe 8 is better, I don't know, I ran from PHP after this) is clunky, slow and confusing. But on top of that we had installed three themes, two were deactivated. Yet somehow a deactivated theme was able to interact with the active theme and break the templating it provided. Amazing. Why would Drupal allow deactivated themes to do that?
So, sure, you get bad programmers everywhere, but the frequency and severity which they occur in PHP means I am never going near it again. It is a bad language.
As an alternative, I find Django a lot easier to get into and use than Drupal.
The most likely person to review my php code is someone who also knows php.
And if I'm using a library whose author preferred camel case along with another library whose author preferred snake case, the problem still exists independent of PHP's inconsistencies.
Let me start with a blatant opinion: I'd rather use PHP than pre-
awaitNode for writing a web application, because callback-oriented development is stupid. Node only became worth using when they addedasync-await, and even with that you end up having to write wrappers for outdated parts of the standard library just to write straightforward code. JavaScript just isn't that good of a programming language anyway.Now with that out of the way, PHP has two big problems:
It's inconsistent. Like, blatantly inconsistent, for no obvious reason. Some functions have prefixes like
array_map($arr, $fn), some of them don't likesort($arr), some of them are not actually functions likeempty($arr), and PHP has method call syntax, but doesn't use it for any of the array stuff. And parts of the standard library use CamelCase, while others use snake_case. The classesstdClassandDateTimeare both in the standard library, too, just in case you were wondering what type of case class names should use.It has built-in affordances that are unusable in large, well-tested codebases. Superglobals, for example, make any functions that use them much harder to test, and php.ini is just one more piece of the environment that can affect whether a piece of code works right or not. And when PHP starts writing warning messages to the browser that get interleaved with the rest of your HTML, stuff can get really, really broken, so you have to turn that off, too, in production.
I must admit that my knowledge of PHP might be outdates (I haven't take a look on PHP for years). But if you once really dislike a language you rarely give it a second chance. Maybe that's one of the core reasons for the bad reputation of this language.
So, I guess you are most likely right and I'm most likely wrong about the PHP of today.
Have you also switched sometimes to PHP too? ;)
Maybe it differs more then you thought...
I think the impact of different syntax/grammar is much much bigger as in natural languages. Or could you easily express the same logic in assembler as in your favourite language. This should be very difficult and take much longer even if you really good in assembler.
that's why Spanish is the second ( or even the first ) spoken language, while German is the first hated :)
You might want to read blog.aurynn.com/2015/12/16-contemp...
I'm one of the PHP haters :) This post is able to express the problems I see with PHP much better than I can: eev.ee/blog/2012/04/09/php-a-fract...
Yeah this one was shared already. My response was basically the beginning states that the author is “cranky.” Which lended itself to mean this blog post is basically bias. In order to make an argument, you have to remain unbiased. After all the comments to this question, I still don’t have a clear answer other than people just don’t like it. And there are many reasons they don’t like it.
Facebook was written in PHP
Some comments may only be visible to logged-in visitors. Sign in to view all comments.