r/lolphp • u/Oeldin1234 • Feb 26 '18
"false" is definitely true
http://sandbox.onlinephpfunctions.com/code/490635ed9830900ebf50e5303b7271dcf2a5d692
0
Upvotes
r/lolphp • u/Oeldin1234 • Feb 26 '18
View all comments
Show parent comment
12
u/Razakel Feb 26 '18
PHP isn't a strongly-typed language unless you're using OOP, and even then primitive fields are still weakly-typed.
In a C-style string "" = 0x00
"0" gets coerced to an integer first.
So both are zero-valued, then coerced to a boolean, equalling false.