PHP | floatval() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share 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 Comment More infoAdvertise with us Next Article PHP atan( ) Function R RICHIK BHATTACHARJEE Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP is_float() Function PHP is_float() is an inbuilt function in PHP. The is_float() function is used to find whether a variable is a float or not. Syntax: boolean is_float($variable_name) Parameter: This function contains a single parameter as shown in the above syntax and described below $variable_name: the variable we w 2 min read PHP atan( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. One of such function is atan() function. The atan() function in PHP is used to find the arc tangent of an argument passed to it whi 2 min read PHP | boolval() Function The boolval() function is an inbuilt function in PHP which gives the Boolean value for a given expression. Syntax: boolean boolval( $expr ) Parameter: This function accepts only one parameter as shown in above syntax and described below: $expr: The expression or the scalar which you want to change i 3 min read PHP atan2( ) Function The atan2() function is a builtin function in PHP and is used to calculate the arc tangent of two variables x and y passed to it as arguments. The function returns the result in radians, which is between -Pi and Pi (inclusive). Syntax: float atan2($y, $x) Parameters: This function accepts two parame 1 min read 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 par 1 min read PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read Like