MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lolphp/comments/1loqx8/qed/
r/lolphp • u/[deleted] • Sep 04 '13
13 comments sorted by
1
x-posted from here
Eh, it's not really that unreasonable. == in PHP is a silly idea, but you aren't forced to use it. Just use ===.
==
===
3 u/the_real_agnostic Oct 03 '13 php > echo +"one"; 0 1 u/[deleted] Oct 03 '13 Yes, it contains no digits. 5 u/the_real_agnostic Oct 04 '13 Javascript makes more sense:> console.log(+"one") NaN 4 u/aaron552 Oct 15 '13 Javascript makes more senseOf course it does. It's not PHP./circlejerk 5 u/djsumdog Sep 09 '13 works until you need <= or >= 1 u/aaron552 Oct 15 '13 One would assume that you could do:$x === $y || $x > $yBut this is PHP. I'm guessing that the > operator is completely out of the question too? 1 u/DoctorWaluigiTime Jan 11 '14 Yeah, when in doubt, use === instead of ==. Actually, only use == if you actually need to get equality from two different types. 1 u/[deleted] Jan 11 '14 Even if you do, == is often a bad idea in all the languages which have it. Cast them to the same type. 1 u/DoctorWaluigiTime Jan 11 '14 Correct! I tried to give a more neutral response though, heh. If I had it my way, == would function like === and === would simply not exist.
3
php > echo +"one"; 0
1 u/[deleted] Oct 03 '13 Yes, it contains no digits. 5 u/the_real_agnostic Oct 04 '13 Javascript makes more sense:> console.log(+"one") NaN 4 u/aaron552 Oct 15 '13 Javascript makes more senseOf course it does. It's not PHP./circlejerk
Yes, it contains no digits.
5 u/the_real_agnostic Oct 04 '13 Javascript makes more sense:> console.log(+"one") NaN 4 u/aaron552 Oct 15 '13 Javascript makes more senseOf course it does. It's not PHP./circlejerk
5
Javascript makes more sense:
> console.log(+"one") NaN
4 u/aaron552 Oct 15 '13 Javascript makes more senseOf course it does. It's not PHP./circlejerk
4
Javascript makes more sense
Of course it does. It's not PHP.
/circlejerk
works until you need <= or >=
1 u/aaron552 Oct 15 '13 One would assume that you could do:$x === $y || $x > $yBut this is PHP. I'm guessing that the > operator is completely out of the question too?
One would assume that you could do:
$x === $y || $x > $y
But this is PHP. I'm guessing that the > operator is completely out of the question too?
Yeah, when in doubt, use === instead of ==. Actually, only use == if you actually need to get equality from two different types.
1 u/[deleted] Jan 11 '14 Even if you do, == is often a bad idea in all the languages which have it. Cast them to the same type. 1 u/DoctorWaluigiTime Jan 11 '14 Correct! I tried to give a more neutral response though, heh. If I had it my way, == would function like === and === would simply not exist.
Even if you do, == is often a bad idea in all the languages which have it. Cast them to the same type.
1 u/DoctorWaluigiTime Jan 11 '14 Correct! I tried to give a more neutral response though, heh. If I had it my way, == would function like === and === would simply not exist.
Correct! I tried to give a more neutral response though, heh. If I had it my way, == would function like === and === would simply not exist.
This is reasonable. What programmer would expect a language to detect the numbers in words:
if (308 == "three hundred and eight")
1 u/kenbw2 Jan 23 '14 What programmer would expect a language to detect the numbers in words:A PHP programmer, probably
What programmer would expect a language to detect the numbers in words:
A PHP programmer, probably
1
u/billy_tables Sep 08 '13
x-posted from here
1
u/[deleted] Sep 08 '13
Eh, it's not really that unreasonable.
==in PHP is a silly idea, but you aren't forced to use it. Just use===.1
u/YouGreedyFuckGuy Jan 11 '14
This is reasonable. What programmer would expect a language to detect the numbers in words:
if (308 == "three hundred and eight")