lundi 25 avril 2016

PHP: 0 == 'NOW()'?

So i'm not one to post something here quickly (nor do I really anticipate in answering questions, sorry I'm just a leecher)... But sometimes I have these quite shocking 'WHY THE HELL' moments in PHP that my mind just can't answer clearly even after working with php for around 15 years... Like below:

if( 0 == 'NOW()' )
{
    echo $value.' equals NOW()';
}

does execute the echo, I know === will solve the problem, but why is this a problem. I ran this in an empty PHP script and thus there is no function NOW() or anything (and it's single quoted)... what's going on in PHP's internal code that triggers this kind of madness?

Aucun commentaire:

Enregistrer un commentaire