3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $map = ' \\ / / / / / \\ \\ \\ / \\ /\\ \\/ \\ / \\ \\ \\ \\ \\ \\ / /'; var_dump( r($map)); function r($m){ $z=strpos($m,"/\\"); $z-=strrpos(substr($m,0,$z),"\n"); $ls=explode("\n",$m);$i=0; $a=[1=>0,2=>0,3=>0,4=>0]; foreach($ls as $l){ $y=$i<count($ls)/2?0:1;//echo $y+0+($y?2:1); $s = substr($l,0,$z-1); $a[$y+0+($y?2:1)][] = strpos($s,"/")?"1":(strpos($s,"\\")?"2":"3"); $s = substr($l,$z); $a[$y+1+($y?2:1)][] = strpos($s,"/")?"1":(strpos($s,"\\")?"2":"3"); $i++; } return $a; }
based on S4l8N
Output for 5.4.2 - 7.2.0
Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 25 Warning: Cannot use a scalar value as an array in /in/AUaEb on line 27 array(4) { [1]=> int(0) [2]=> int(0) [3]=> int(0) [4]=> int(0) }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/AUaEb on line 21
Process exited with code 255.