problem with Infinity in number_format

0

I use the 'number_format' function of php, to format values in the pattern I want.

I do this:

number_format($valor_form, 2, '.', '');

The problem is that at some point the user informs a very crazy value in the form, and causes an error in the function, because an 'Infinity' string arrives.

My question is about checking if it is a string, and if I have to change the value of the variable 'value_form' to 0.

Can anyone help me?

    
asked by anonymous 09.12.2016 / 14:23

0 answers