3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i='4N4P9N7P1N1P2N2P'; preg_match_all('/(\d+)(\w)/',$i,$m,2); foreach($m as $p){$k=$p[1];$o.=($p[2]=='N')?str_repeat('=',$k):str_repeat('- ',(int)($k/2)).($k%2?'-':'');} $a=str_repeat('_',$n=strlen($o)); $b=str_repeat(' ',$n); echo("$a\n$b\n$b\n$o\n$b\n$a\n$n");

preferences:
39.56 ms | 402 KiB | 5 Q