The following float typecast and floatval() SHOULD return floats, but they're returning doubles. I'm using PHP5. What's going on?
$test = "123.456";
echo "The string value of \$test is: " . $test . "<br /><br />\n";
echo "The type of (float)\$test is: " . gettype((float)$test) . "<br />\n";
echo "The value of (float)\$test is: " . (float)$test . "<br /><br />\n";
echo "The type of floatval(\$test) is: " . gettype(floatval($test)) . "<br />\n";
echo "The value of floatval(\$test) is: " . (float)$test . "<br />\n\n";
This displays:
The string value of $test is: 123.456
The type of (float)$test is: double
The value of (float)$test is: 123.456
The type of floatval($test) is: double
The value of floatval($test) is: 123.456
What's the deal? Why am I not getting floats. I've tested this on my workstation with WAMP5, and on my 1and1 account using a LAMP5 setup. Same results.