<?php
$code = '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.+++.';
$commands = array(
'>' => '$ptr++;',
'<' => '$ptr--;',
'+' => '$cells[$ptr]++;',
'-' => '$cells[$ptr]--;',
'.' => 'echo chr($cells[$ptr]);',
',' => 'throw new Exception(", not supported");',
'[' => 'while($cells[$ptr]) {',
']' => '}'
);
$php_code = strtr($code, $commands);
$cells = array(
0,
0,
0,
0,
0,
0,
0,
0
);
$ptr = 0;
eval($php_code);
preferences:
30.88 ms | 402 KiB | 5 Q