3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(null, 0, 1, 1.1, 1.15111, -10.22, "1,222", "1.1", array(1.1)); foreach ( $a as $i ) { var_dump(number_format($i, 2, '.', '')); }
Output for 7.0.0 - 7.1.0
string(4) "0.00" string(4) "0.00" string(4) "1.00" string(4) "1.10" string(4) "1.15" string(6) "-10.22" Notice: A non well formed numeric value encountered in /in/RICr0 on line 6 string(4) "1.00" string(4) "1.10" Warning: number_format() expects parameter 1 to be float, array given in /in/RICr0 on line 6 NULL
Output for 5.3.0 - 5.4.45, hhvm-3.10.0 - 3.12.0
string(4) "0.00" string(4) "0.00" string(4) "1.00" string(4) "1.10" string(4) "1.15" string(6) "-10.22" string(4) "1.00" string(4) "1.10" Warning: number_format() expects parameter 1 to be double, array given in /in/RICr0 on line 6 NULL
Output for 5.5.0 - 5.6.28
string(4) "0.00" string(4) "0.00" string(4) "1.00" string(4) "1.10" string(4) "1.15" string(6) "-10.22" Notice: A non well formed numeric value encountered in /in/RICr0 on line 6 string(4) "1.00" string(4) "1.10" Warning: number_format() expects parameter 1 to be double, array given in /in/RICr0 on line 6 NULL
Output for 4.3.0 - 5.2.17
string(4) "0.00" string(4) "0.00" string(4) "1.00" string(4) "1.10" string(4) "1.15" string(6) "-10.22" string(4) "1.00" string(4) "1.10" string(4) "1.00"