vendredi 15 mars 2019

PHP check if 0x0 is always true [duplicate]

This question already has an answer here:

I am reading some binary dataset and wanted to check if some value is x'00'. But my condition always returned true and I have no idea why...

My try was to do like that:

$value = 'i am not x0';
if ($value == 0x0) {
    echo "it is true" . PHP_EOL;
} else {
    echo "it is false" . PHP_EOL;
}

Why this if results in true?

Aucun commentaire:

Enregistrer un commentaire