3v4l.org

run code in 300+ PHP versions simultaneously
<?php $MAP = [ ['x', 'x', 'x', 'x'], ['x', 's', 'p', 'x'], ['x', 'p', 'p', 'x'], ['x', 'p', 'p', 'x'], ['x', 'p', 'p', 'x'], ['x', 'p', 'p', 'x'], ['x', 'x', 'x', 'x'], ]; function whatever_i_cba_naming_shit_at_this_time_of_night($data) { foreach ($data as $y => $row) { foreach ($row as $x => $cell) { yield ['x' => $x, 'y' => $y] => $cell; } } } foreach (whatever_i_cba_naming_shit_at_this_time_of_night($MAP) as $coordinates => $cell) { echo "{$coordinates['x']}/{$coordinates['y']} => $cell\n"; }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
0/0 => x 1/0 => x 2/0 => x 3/0 => x 0/1 => x 1/1 => s 2/1 => p 3/1 => x 0/2 => x 1/2 => p 2/2 => p 3/2 => x 0/3 => x 1/3 => p 2/3 => p 3/3 => x 0/4 => x 1/4 => p 2/4 => p 3/4 => x 0/5 => x 1/5 => p 2/5 => p 3/5 => x 0/6 => x 1/6 => x 2/6 => x 3/6 => x
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
203.6 ms | 407 KiB | 5 Q