PHP Numeric string comparison wrong resuslts [duplicate]

Hello I have to compare strings with numbers, and I have some issues, I did some dumps to try:

            var_dump((string)$prod->Code);
            echo "<br>";
            var_dump($code);
            var_dump((string)$prod->Code == $code);
            echo "<br>";
            echo "<br>";

I got the following results:

string(4) "0539"
string(5) "00539" bool(true)

Basically “0539” is equal to “00539”

What can I do?

I tried also strcmp, I would expect “0539” to test equal to “0539” but not equal to “00539” AND “00539” to test equal to “00539” but not equal to “0539”