3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $i='4N4P9N7P1N1P2N2P'; print_r(preg_split('/(?<=\w)/',$i)); exit(); 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 mTdsr
Output for 4.3.0 - 7.2.0
Array ( [0] => 4 [1] => N [2] => 4 [3] => P [4] => 9 [5] => N [6] => 7 [7] => P [8] => 1 [9] => N [10] => 1 [11] => P [12] => 2 [13] => N [14] => 2 [15] => P [16] => )