3v4l.org

run code in 300+ PHP versions simultaneously
<?php $float = 1.223; $float2 = 789.012; $prefix = ' World67'; echo round($float, 2). ' Hello ' . (int) $float . substr($prefix, 0, 6) . substr($prefix, 0, 6); echo \PHP_EOL; echo round($float2, 2). ' Hello ' . (int) $float2 . substr($prefix, 0, 6) . substr($prefix, 0, 6); echo \PHP_EOL . '---' . \PHP_EOL; $pattern = '%1$.2f Hello %1$.d %2$.6s'; printf($pattern, $float, $prefix); echo \PHP_EOL; printf($pattern, $float2, $prefix); echo \PHP_EOL; //purposefully error printf($pattern, $prefix);
Output for git.master, git.master_jit, rfc.property-hooks
1.22 Hello 1 World World 789.01 Hello 789 World World --- 1.22 Hello 1 World 789.01 Hello 789 World Fatal error: Uncaught ArgumentCountError: 3 arguments are required, 2 given in /in/8PWil:16 Stack trace: #0 /in/8PWil(16): printf('%1$.2f Hello %1...', ' World67') #1 {main} thrown in /in/8PWil on line 16
Process exited with code 255.

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:
61.78 ms | 401 KiB | 8 Q