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);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
170.74 ms | 1698 KiB | 12 Q