This error is common when the function number_format recieves an empty string or a string with special characters. To solve this you can use floatval to make the conversion to float.
number_format( floatval ($string_variable), 2);