PHP floatval() function
Description
Gets the float value of var.
Syntax
PHP floatval() function has the following syntax.
float floatval ( mixed $var )
Parameter
- var - scalar type to convert.
Return
The float value of the given variable. Empty arrays return 0, non-empty arrays return 1.
Example
Get the float value
<?php//w w w .j a va 2 s . c o m
$var = '122.34343The';
$float_value_of_var = floatval($var);
echo $float_value_of_var; // 122.34343
?>
The code above generates the following result.