> Most developers who hate PHP hate it out of elitism or ignorance. Either way it’s dumb. You have to choose a technology based on what you need. PHP is highly useful and powerful in many scenarios. And taking it out of the equation just because of its reputation is not a good idea. When I conduct hiring interviews, one of the questions I like to ask regardless of the language for the position, is the developer opini…
PHP has its pros and cons. A big pro is definitively job security: learn it now, learn it well and you'll have work for quite a long time. Composer is a pretty sane package manager, there are tons of frameworks and libraries out there to do nearly anything you can imagine, and also it's surprisingly fast. I'll even forgive the operator weirdness-- one big pain point that remains for me is how debugging PHP code is do…
Why Developers Hate PHP
101–110 of 114 posts
Re: Why Developers Hate PHP
#102Earlier quoted context omitted.
> For PHP, the problem is that it came about at just the right time to be picked up by WordPress and Facebook, hence encrusting itself in most of the web we see. That's backwards in my opinion. PHP was successful among non-CS-people, and those people started building things they were interested in. That gave PHP the initial success (especially on the web, were plenty of people didn't have a CS background unlike in en…
The first version of Wikipedia used usemod, which is Perl. The "phase II" version in PHP was written by Magnus Manske (who is indeed a non-CS-person).
Re: Why Developers Hate PHP
#103Earlier quoted context omitted.
null == 0 is true. null === 0 is false. false == 0 is true. false === 0 is false. null == false is true. null === false is false. null < -1 is true.
are you sure null < -1 is true? If it's the case what happens to 0 < -1?
if (null > -1) { echo "null > -1\n"; }
if (null if (null == -1) { echo "null == -1\n"; }
if (null === -1) { echo "null === -1\n"; }
if (0 if (0 > -1) { echo "0 > -1\n"; }
if (0 == -1) { echo "0 == -1\n"; }
if (0 === -1) { echo "0 === -1\n"; }
results:
null 0 > -1
Re: Why Developers Hate PHP
#104> Most developers who hate PHP hate it out of elitism or ignorance. Either way it’s dumb. You have to choose a technology based on what you need. PHP is highly useful and powerful in many scenarios. And taking it out of the equation just because of its reputation is not a good idea. When I conduct hiring interviews, one of the questions I like to ask regardless of the language for the position, is the developer opini…
Did PHP ever decide whether NULL < -1 or NULL == 0? I want to hire people who care about correctness, and insanity like that really should bother them.
null == 0 is true
null === 0 is false
false == 0 is true
false === 0 is false
null == false is true
null === false is false
null
https://3v4l.org/UJ3tmRe: Why Developers Hate PHP
#105I write very little PHP but I work on a PHP extension written in C for a security product that integrates tightly with the language and some of the reasons I hate it are: The Zend APIs suck, and they have non-existent or severely outdated docs. For example, one of PHP's main internal data structure, zend_hash, is a weird hash table with a string / int union key type and is awkward to access or iterate over. Memory is…
Re: Why Developers Hate PHP
#106> Most developers who hate PHP hate it out of elitism or ignorance. Either way it’s dumb. You have to choose a technology based on what you need. PHP is highly useful and powerful in many scenarios. And taking it out of the equation just because of its reputation is not a good idea. When I conduct hiring interviews, one of the questions I like to ask regardless of the language for the position, is the developer opini…
PHP always struck me as a language that had very haphazard beginnings and initial design considerations that continue to cause it problems, but less so as time goes one, that has made mostly good and well thought out decisions since then (and possibly because of that). The base language functions are a train wreck of multiple functions doing similar things that could easily be handled through a few slightly more flex…
This is an inheritance from C. Most of these functions are present in libc and the bound libraries (e.g. libcurl), with the same arguments. 20something years ago, this was a big selling point to me, because I didn't have to re-learn the functions, just use the function and forget about malloc()/free()...
Re: Why Developers Hate PHP
#107> Most developers who hate PHP hate it out of elitism or ignorance. Either way it’s dumb. You have to choose a technology based on what you need. PHP is highly useful and powerful in many scenarios. And taking it out of the equation just because of its reputation is not a good idea. When I conduct hiring interviews, one of the questions I like to ask regardless of the language for the position, is the developer opini…
its fun to trash talk PHP who cares if statements are accurate. PHP sucks because of the dollar signs everywhere. From a distance Wordpress code looks like Nigerian Prince emails. And crazy coding conventions like mysql_real_escape_string. Really PHP?
Re: Why Developers Hate PHP
#108All of our sophistication and unit tests live inside the C# back-end projects. While the PHP in the UI layer is limited to very simple code like for loops and templating; otherwise they're mostly design projects centered around HTML/CSS/UI/UX. Keeping it so simple makes it rather easy for designers to pick up on and work with.
I started a small website to document this pattern:
I have advocated for its use on most of my projects, but obviously the mere mention of PHP stirs up a lot of knee-jerk reactions.
Re: Why Developers Hate PHP
#109Earlier quoted context omitted.
PHP always struck me as a language that had very haphazard beginnings and initial design considerations that continue to cause it problems, but less so as time goes one, that has made mostly good and well thought out decisions since then (and possibly because of that). The base language functions are a train wreck of multiple functions doing similar things that could easily be handled through a few slightly more flex…
> there's little consistency between types and orders of arguments in the base functions of the language This is an inheritance from C. Most of these functions are present in libc and the bound libraries (e.g. libcurl), with the same arguments. 20something years ago, this was a big selling point to me, because I didn't have to re-learn the functions, just use the function and forget about malloc()/free()...
It was a benefit to those that knew C and worked with the same libs there, and it was easier for early PHP developers to include stuff (since they didn't have to develop a separate API and abstract usage), but it definitely contributed to PHP's reputation of being hard to intuit how a function expected to be used.
You can compare and contrast this to Perl, where for the most part they didn't include C libraries in the core (generally they were done as modules, and there are modules that emulate C's calling methods exactly, and those that provide an extrapolated API, sometimes from the base library, sometimes building on the other module), but they did include a lot of the C standard library functions in familiar usage patters, but still altered to fit the design goals and ideas Perl was being developed with (Perl is a highly designed language, it's just that its design goals often make it look haphazard to those that haven't internalized them).
Both approaches have their strengths and weaknesses. I would say PHP's approach was useful very early on, but quickly became detrimental for most users (it was useful longer for devs I imagine), but PHP's other strengths helped mitigate that (IMO, being able to be built into Apache in a manner other languages couldn't imitate well was a killer feature for a long time).
Re: Why Developers Hate PHP
#110Earlier quoted context omitted.
> there's little consistency between types and orders of arguments in the base functions of the language This is an inheritance from C. Most of these functions are present in libc and the bound libraries (e.g. libcurl), with the same arguments. 20something years ago, this was a big selling point to me, because I didn't have to re-learn the functions, just use the function and forget about malloc()/free()...
This clearly shows PHP's origin as a set of loosely related libraries and utilities ties together with a thin veneer of a language. When used as an actual language it's less than ideal. Who's to say curl will still be the default way it makes some requests in the core language later? What if the library changes it's API after deprecating the version that was originally used? Coupling things like that is a poor design…
Most people who pick PHP these days are doing that because these very mature frameworks. I see no alternative to Drupal with all its glory in any of the modern languages.
I think PHP-s success was related to its relative low latency compared the early Ruby and Perl, especially when FCGI became supported. We could easily serve 200+ interactive websites on a single desktop PC, with five-nines SLO.
Sure, there are much better, more fun languages these days, but to retire PHP we need to find better worthy FOSS alternatives to the PHP CMS-es.