PHP floatval(), doubleval() Functions
floatvalThe function is used to get the floating-point value of a variable.
floatval cannot be used on arrays or objects.
Version requirements: PHP 4 >= 4.2.0, PHP 5, PHP 7.
doubleval is an alias of floatval.
Syntax
float floatval ( mixed $var )
Parameter description:
- $var: The variable to be converted, cannot be an array or object.
Return Value
The float value of variable var.
Example
Example
$var = '122.34343example';
$float_value_of_var = floatval ($var);
echo $float_value_of_var;
The execution result is as follows:
122.34343Other Extensions
PHP Available Functions