3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ '1,000.00', '1,000.000', '1.000,00', '1.000,000', '1.00', '1.000', '1,00', '1,000', ]; $result = []; foreach ($tests as $test) { $result[] = preg_match('/,\d*$/', $test) ? ['input' => $test, 'thousands' => '.', 'decimal' => ','] : ['input' => $test, 'thousands' => ',', 'decimal' => '.']; } var_export($result);

preferences:
25.2 ms | 405 KiB | 5 Q