FILTER_VALIDATE_FLOAT constant in PHP

PHPProgrammingServer Side Programming

The FILTER_VALIDATE_FLOAT constant validates a value as a float number.

Return

The FILTER_VALIDATE_FLOAT constant does not return anything.

Example

 Live Demo

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

Output

The following is the output.

float(291.9)
raja
Published on 04-Dec-2018 06:57:46
Advertisements