PHP | floatval() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The floatval() function is an inbuilt function in PHP which returns the float value of a variable. Syntax: float floatval ( $var ) Parameters: This function accepts one parameter which is mandatory and described below: $var: The variable whose corresponding float value will be returned. This variable should not be an object. Return Value: It returns float value of given variable. Empty array returns 0 and non-empty array returns 1. Note: If an object is passed to the function, it produce an E_NOTICE level error and return 1. Examples: Input : $var = '41.68127E3' Output : 41681.27 Input : $var = '47.129mln' Output : 47.129 Below programs illustrate the use of floatval() function in PHP: Program 1: php <?php $var = '41.68127E3'; $float_value = floatval($var); echo $float_value; ?> Output: 41681.27 Program 2: php <?php $var = '47.129mln'; $float_value = floatval($var); echo $float_value; ?> Output: 47.129 Reference: https://www.php.net/manual/en/function.floatval.php Create Quiz Comment R RICHIK BHATTACHARJEE Follow 0 Improve R RICHIK BHATTACHARJEE Follow 0 Improve Article Tags : Misc Web Technologies PHP PHP-function Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like