3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $separator = 'comma'; $number = '1,233,332.34'; $number2 = '1.233.332,34'; $thousand_separator = ','; if ($separator != 'comma') { $thousand_separator = '.'; } // Remove the thousand separator $number = str_replace($thousand_separator, '', $number); $number2 = str_replace($thousand_separator, '', $number2); echo '$number: ' . number_format($number, 2, ',','.') . PHP_EOL; echo '$number: ' . number_format($number2, 2, ',','.') . PHP_EOL;
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
$number: 1.233.332,34 Notice: A non well formed numeric value encountered in /in/MoSEk on line 16 $number: 1,23
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.17, hhvm-3.12.0
$number: 1.233.332,34 $number: 1,23
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/MoSEk on line 15 $number: 1.233.332,34PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/MoSEk on line 16 $number: 1,23PHP_EOL