PHP string with decimals to number

So when I try the following:

$a = '1.00';
$b = '1.01';

if($a < $b){
    print 'ok';

This works fine. But when I retrieve these variables from an xml file. the strings are EXACTLY the same, but for some reason, the if function doesn't work right. So I assume I have to convert the strings to a number. But when I do so, the decimals get removed.

Is my assumption correct? If so, how do i solve it?

If not, what's the problem?

Thank you!


$a = (float) $a;
$b = (float) $b;

Related reading:

Found the answer by googling :)


Need Your Help

WSO2 Identity Server startup error - Error in initializing thrift transport

wso2 wso2is

I just installed WSO IS and receive this error when starting the server.

Karma tests does not seem to load my Angularjs controller

angularjs testing controller karma-runner

I run my angular tests with karma, my application is running fine in browser, but tests fails and I am suspecting wrong settings.