3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $map = ' \\ / / / / / \\ \\ \\ / \\ /\\ \\/ \\ / \\ \\ \\ \\ \\ \\ / /'; echo( r($map)['s']); function r($m){ $z=strpos($m,"/\\"); $z-=strrpos(substr($m,0,$z),"\n"); $ls=explode("\n",$m);$i=0; foreach($ls as $l){ $y=$i<count($ls)/2?0:1; foreach([0,1] as $x){ $s = substr($l,$x?($z-1):0,$x?$z*$z:$z); $a[$y+$x+($y?2:1)][] = strpos($s,"/")?"/":(strpos($s,"\\")?"\\":""); } $i++; } $n=1; foreach($a as $k=>$p){ $t=$p[$k<3?count($p)-1:0]; $s=0;$x=0;$b[$k]['s']=''; for($j=count($p)-1;$j>=0;$j--){ if($p[$j]){ $b[$k]['s'] .= strpad("",$j," ").($p[$j] === $t ? '/' : '_')."\n"; $s+=$p[$j]==$t?1:0; $x++; } } $b[$k]['t']=$s/$x; $n=$b[$k]['t']<$b[$n]['t']?$k:$n; } return $b[$n]; }
based on 5Y9Zf
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function strpad() in /in/HbW3W:35 Stack trace: #0 /in/HbW3W(15): r(' ...') #1 {main} thrown in /in/HbW3W on line 35
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Fatal error: Call to undefined function strpad() in /in/HbW3W on line 35
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/HbW3W on line 15
Process exited with code 255.