PHP doubleval() Function

❮ PHP Variable Handling Reference

Example

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 »

Definition and Usage

The doubleval() function returns the float value of a variable.

This function is an alias of floatval().


Syntax

doubleval(variable);

Parameter Values

Parameter Description
variable Required. Specifies the variable to check. Must be a scalar type

Technical Details

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+

❮ PHP Variable Handling Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.