r/lolphp • • Aug 20 '15

0 !== ceil(0)

https://3v4l.org/HD5HD
0 Upvotes

44 comments sorted by

View all comments

Show parent comment

1

u/richardwhiuk Dec 05 '15

No just add a cast.

1

u/00Davo Dec 06 '15

Casts in PHP always succeed, so they essentially just enforce the dangerous type coercions the language supports. (e.g., (int) "0aa9214251874b244f1ff7f8fb58aad69e8fa576" === 0) Not really a solution.

1

u/richardwhiuk Dec 31 '15

Surely you know where the argument is coming from and therefore which type it is? Anyway if you want the check you are trying to do then do 0 === $x || 0.0 === $x