PHP floatval() Function

PHP get_defined_vars() Function
PHP empty() Function

In this article, you will learn how to get the floating value of a variable in PHP. The floatval() function in PHP returns the float value of a variable.

what is the syntax of the FLOATVAL() function in php?

floatval(variable);
ParameterDescription
variableRequired. Specifies the variable to check. Must be a scalar type
PHP FLOATVAL() method

examples of the FLOATVAL() function

Example 1. In this example, we get the float value of different variables.

<?php
$a = "1234.56789";
echo floatval($a) . "<br>";

$b = "1234.56789Hello";
echo floatval($b) . "<br>";

$c = "Hello1234.56789";
echo floatval($c) . "<br>";
?>
PHP get_defined_vars() Function
PHP empty() Function
en English
X
Scroll to Top