3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $i='4N4P19N7P1N1P2N2P'; print_r(preg_split('/(?<=\d)/',$i)); exit(); //foreach() preg_match_all('/(\d+)(\w)/',$i,$m,2); foreach($m as $p)$o.=str_repeat($p[2]=='N'?'=':'-',$p[1]); $a=str_repeat('_',$n=strlen($o=str_replace('--','- ',$o))); echo("$a\n\n\n$o\n\n$a\n");
based on 12E0f
Output for 4.3.0 - 7.2.0
Array ( [0] => 4 [1] => N4 [2] => P1 [3] => 9 [4] => N7 [5] => P1 [6] => N1 [7] => P2 [8] => N2 [9] => P )