Earlier quoted context omitted.
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 < -1 is true.
Why Developers Hate PHP
91–100 of 114 posts
Re: Why Developers Hate PHP
#92Earlier 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.
Like in JavaScript, just don't use ==. It's broken but you don't have to use it. In C you can write i[t] instead of t[i], but don't do it. I guess it's true for many languages. These funny features don't prevent you from writing good code, especially if you enforce some coding styles that will catch any unintended use of these features. Blame PHP for what you can't do with it, or for things you don't like but are for…
I had to check this myself. I'm astonished.
Re: Why Developers Hate PHP
#93Re: Why Developers Hate PHP
#94Earlier quoted context omitted.
This is not really a question like any other, because it's a very polarizing one. It's fair to intentionally ask polarizing questions if the objective is to find how if a candidate can take moderate positions in those contexts, but it's definitely not like "any question in interviews".
Fair enough. It's not comparable to just any question. But hear me, you have to poke the bee's nest with some polarizing questions to really know what's inside otherwise you're stuck hiring an unknown until it's too late and costly (for both parties) to find out they were not a good match.
Re: Why Developers Hate PHP
#95Python, Ruby, Javascript and others have a "debugger;" statement of some sort that, when hit by the execution flow, will pause the code and let you type stuff in your shell, letting you inspect the code, step forward, etc...
Why does PHP need me to configure an entire IDE or my browser? (I'm looking at you, xdebug). Why can't it have a cli-debugger?
Re: Why Developers Hate PHP
#96Earlier quoted context omitted.
Like in JavaScript, just don't use ==. It's broken but you don't have to use it. In C you can write i[t] instead of t[i], but don't do it. I guess it's true for many languages. These funny features don't prevent you from writing good code, especially if you enforce some coding styles that will catch any unintended use of these features. Blame PHP for what you can't do with it, or for things you don't like but are for…
> In C you can write i[t] instead of t[i], but don't do it. I had to check this myself. I'm astonished.
*(t + i)
So you can see how swapping that around to `i[t]` is effectively the same operation: *(i + t)Re: Why Developers Hate PHP
#97Earlier 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?
Re: Why Developers Hate PHP
#98> 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?
That is my personal experience anyway, as someone whose first truly serious language was PHP 20 years ago. Maybe it was just because I was used to it (BASIC also used $), but it took me a bit to get used to the "bare" variables in Python and C back in the day.
Re: Why Developers Hate PHP
#99> 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…
That said, after dealing with JavaScript and its inane ecosystem has made me appreciate all the ways in which PHP has improved over the years, although that's probably not the kind of answer you'd be looking for. :P
Re: Why Developers Hate PHP
#100But ... that doesn't mean that PHP is a good language, or that people hate in PHP "just because it's cool". There are still many issues that remain. For example the very loose typing checking remains an issue and source of real bugs; e.g. a while ago a SAML library could be bypassed because it forgot to add the flag to in_array() to enable strict comparisons.
Much of the problems in PHP are with the standard library, and this is not easy to fix. Even the mysql deprecation (in favour of mysqli/PDO) took ages. I wrote a thing looking at fopen() in PHP a while ago, and I think it's a good example of the problems that remain in PHP: https://www.arp242.net/php-fopen-is-broken.html
There are still many issues with the standard library like this which are clumsy and just plain design errors, and many of them are too fundamental to work around or fix. Has PHP evolved? Sure, and that's great! But that doesn't mean it's now an especially good language. In general, I'd rather have a poor language with a good standard library than a good language with a poor standard library.
Aside: one weird thing about PHP's stdlib is that it's all written in C; I don't know any other comparable language where all of the standard library is written in C. I think this seriously hamper's the evolution of PHP's stdlib to a more modern experience.
There is no easy fix for any of this btw, because a revamping of the stdlib would likely lead to a "Python 3 scenario", so I don't blame the PHP devs for not fixing it (although I do blame them for introducing new flawed parts to the stdlib, like the whole DateTime fiasco), but that doesn't mean it's not a problem.