3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i='4N4P9N7P1N1P2N2P'; preg_match_all('/(\d+)(\w)/',$i,$m,2); print_r($m); foreach($m as $p) { if ($p[2]=='N') { $o.=str_repeat('=',$p[1]); } else { $o.=str_repeat('- ',(int)($p[1]/2)).($p%2?'-':''); } } echo($o);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => 4N [1] => 4 [2] => N ) [1] => Array ( [0] => 4P [1] => 4 [2] => P ) [2] => Array ( [0] => 9N [1] => 9 [2] => N ) [3] => Array ( [0] => 7P [1] => 7 [2] => P ) [4] => Array ( [0] => 1N [1] => 1 [2] => N ) [5] => Array ( [0] => 1P [1] => 1 [2] => P ) [6] => Array ( [0] => 2N [1] => 2 [2] => N ) [7] => Array ( [0] => 2P [1] => 2 [2] => P ) ) Warning: Undefined variable $o in /in/UN52a on line 8 Fatal error: Uncaught TypeError: Unsupported operand types: array % int in /in/UN52a:10 Stack trace: #0 {main} thrown in /in/UN52a on line 10
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:
54.49 ms | 402 KiB | 8 Q