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);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 0 => array ( 'input' => '1,000.00', 'thousands' => ',', 'decimal' => '.', ), 1 => array ( 'input' => '1,000.000', 'thousands' => ',', 'decimal' => '.', ), 2 => array ( 'input' => '1.000,00', 'thousands' => '.', 'decimal' => ',', ), 3 => array ( 'input' => '1.000,000', 'thousands' => '.', 'decimal' => ',', ), 4 => array ( 'input' => '1.00', 'thousands' => ',', 'decimal' => '.', ), 5 => array ( 'input' => '1.000', 'thousands' => ',', 'decimal' => '.', ), 6 => array ( 'input' => '1,00', 'thousands' => '.', 'decimal' => ',', ), 7 => array ( 'input' => '1,000', 'thousands' => '.', 'decimal' => ',', ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.16 ms | 407 KiB | 5 Q