I have this code
$vad = 1.1;
print gettype($vad);
var_dump($vad);
this will output:
double
float(1.1)
So it is double or float in php?
I have this code
$vad = 1.1;
print gettype($vad);
var_dump($vad);
this will output:
double
float(1.1)
So it is double or float in php?
There is no difference in PHP. 'float', 'double' or 'real' are the same datatype.
At the C level, everything is stored as a double.
The real size is still platform-dependant.
See the manual for more details:
http://www.php.net/manual/en/language.types.float.php
For PHP, they are the same. http://www.php.net/manual/en/language.types.float.php :
Floating point numbers (also known as "floats", "doubles", or "real numbers") can be specified using any of the following syntaxes: [...]
The confusing part is why gettype (which you shouldn't use, anyway) returns "double" instead of "float". The answer is http://de2.php.net/manual/en/function.gettype.php:
" double " (for historical reasons "double" is returned in case of a float , and not simply "float")
True Answer: http://docs.sun.com/source/806-3568/ncg_goldberg.html
Short Answer: its all about the precision.