Computer >> Computer tutorials >  >> Programming >> PHP

FILTER_VALIDATE_FLOAT constant in PHP


The FILTER_VALIDATE_FLOAT constant validates a value as a float number.

Return

The FILTER_VALIDATE_FLOAT constant does not return anything.

Example

<?php
   $var = 291.9;
   var_dump(filter_var($var, FILTER_VALIDATE_FLOAT));
?>

Output

The following is the output.

float(291.9)