❮ PHP Variable Handling Reference
Return 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>";
?>
Try it Yourself »
The doubleval() function returns the float value of a variable.
This function is an alias of floatval().
doubleval(
variable);
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check. Must be a scalar type |
Return Value: | The float value of the variable on success, 0 on failure. An empty array will return 0, and a non-empty array will return 1 |
---|---|
Return Type: | Float |
PHP Version: | 4.0+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!