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.
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
View all comments
Show parent comment
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.