Friday, February 6, 2026
HomeLanguagesPHP | doubleval() Function

PHP | doubleval() Function

The doubleval() is an inbuilt function in PHP which is used to get a float value of a variable. This function is an alias of floatval().

Syntax:

doubleval ( $variable_name )

Parameters: This function accepts one parameter $variable_name as shown in above syntax. It is a mandatory parameter. This parameter specifies the name of variable that is to be converted. This parameter can be of mixed type example integer, string, etc.

Return Value: It returns float value of given variable.

Below programs illustrate the use of doubleval() function in PHP:
Program 1:




<?php
  
// PHP program to illustrate 
// doubleval() function
$var = '41.68127E3';
$double_value = doubleval($var);
echo $double_value;
?>


Output:

41681.27

Program 2:




<?php
  
// PHP program to illustrate 
// doubleval() function
$var = '47.129mln';
$double_value = doubleval($var);
echo $double_value;
?>


Output:

47.129

Related Articles:

Reference:http://php.net/manual/en/function.doubleval.php

RELATED ARTICLES

Most Popular

Dominic
32489 POSTS0 COMMENTS
Milvus
126 POSTS0 COMMENTS
Nango Kala
6862 POSTS0 COMMENTS
Nicole Veronica
11983 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12073 POSTS0 COMMENTS
Shaida Kate Naidoo
6995 POSTS0 COMMENTS
Ted Musemwa
7236 POSTS0 COMMENTS
Thapelo Manthata
6946 POSTS0 COMMENTS
Umr Jansen
6930 POSTS0 COMMENTS