3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_number($number) { $str = number_format($number, 4, '.', ''); $str = preg_replace('/(?<\.\d{2})0+$/', '', $str); return $str; } var_dump(format_number(4.0)); var_dump(format_number(4.5)); var_dump(format_number(4.454)); var_dump(format_number(4.54545454)); var_dump(format_number(4.450));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: preg_replace(): Compilation failed: subpattern name expected at offset 3 in /in/JPUJO on line 5 NULL Warning: preg_replace(): Compilation failed: subpattern name expected at offset 3 in /in/JPUJO on line 5 NULL Warning: preg_replace(): Compilation failed: subpattern name expected at offset 3 in /in/JPUJO on line 5 NULL Warning: preg_replace(): Compilation failed: subpattern name expected at offset 3 in /in/JPUJO on line 5 NULL Warning: preg_replace(): Compilation failed: subpattern name expected at offset 3 in /in/JPUJO on line 5 NULL

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:
26.01 ms | 402 KiB | 8 Q