Skip to content
Advertisement

PHP is_float() validation

I need to (check) if my input is float but I cannot get it to work.

JavaScript

I also tried to add 0 inside my if statement but nothing changed

JavaScript

Advertisement

Answer

You should make use of floatval() here, to convert your string to a float, if possible.

As an example:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement