In this article, you will learn how to get the floating value of a variable in PHP. The doubleval() function in PHP returns the float value of a variable. This function is an alias of floatval().
what is the syntax of the DOUBLEVAL() function in php?
doubleval(variable);
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check. Must be a scalar type |
examples of the DOUBLEVAL() function
Example 1. In this example, we get the float value of different variables.
<?php
$a = "1234.56789";
echo doubleval($a) . "<br>";
$b = "1234.56789Hello";
echo doubleval($b) . "<br>";
$c = "Hello1234.56789";
echo doubleval($c) . "<br>";
?>