Why does “echo strcmp('60', '100');” in php output 5?
PHP's documentation on this function is a bit sparse and I have read that this function compares ASCII values so... echo strcmp('hello', 'hello'); //outputs 0 as expected - strings are equal. echo '<hr />'; echo strcmp('Hello', 'hello'); //outputs -32, a negative number is expected as //uppercase H has a lower ASCII value than lowercase h. echo '<hr />'; echo strcmp('60', '100'); //outputs 5. The last example is confusing me. I don't understand why it is outputting a positive number. ASCII Value of 0 = 48 ASCII Value of 1 = 49 ASCII Value of 6 = 54 Total ASCII value of '60' = (54 + 48) = 102