3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "~([^\d.,]|[.,](?!\d{2}$))|(,)~m"; $strings = [ "2.578,20", "2 354,20", "234", "234,256.20", "234,205", "246 548", "244'056", "26'155.25", "12,20", "13.33", ]; foreach ($strings as $string) { echo preg_replace_callback($pattern, function ($matches) { if (isset($matches[2])) return "."; if (isset($matches[1])) return ""; }, $string) . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
2578.20 2354.20 234 234256.20 234205 246548 244056 26155.25 12.20 13.33

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:
164.68 ms | 405 KiB | 5 Q