@ 2017-06-02T18:07:49Z <?php
//$states = json_decode('[[[2,0,1],[1,1,0]],[[4,1],[3,0,1]]]');
$states = json_decode('[[[2,0,1],[1,1,0]],[[4,1,2],[3,0,1]],[[99,0],[99,0],[22,0],[33,1,2]]]');
$state = 0;
$tape = array(1, 1, 1, 1, 0, 0, 0);
if (substr(phpversion(), -5) == '-hhvm') {
$updatesInternalPointer = true;
$rightEdgeBug = false;
} elseif (substr(phpversion(), 0, 1) == 7) {
$updatesInternalPointer = false;
$rightEdgeBug = false;
} else {
$updatesInternalPointer = true;
$rightEdgeBug = true;
}
if ($rightEdgeBug) $tape[] = 0;
foreach ($tape as $k => &$v) {
if (is_null($state)) break;
@list ($v, $d, $state) = $states[$state][$v];
if ($d) {
if (count($tape) - $k < ($rightEdgeBug ? 3 : 2)) $tape[] = 0;
if (!$updatesInternalPointer) next($tape);
} elseif ($k) {
$lol = $tape;
//prev($tape);
//if (!$php7lol) prev($tape);
prev($lol);
if ($updatesInternalPointer) prev($lol);
$tape = $lol;
unset($lol);
} else {
array_unshift($tape, 0);
if (!$updatesInternalPointer) {
$lol = $tape;
reset($tape);
unset($lol);
}
}
}
unset($v);
if ($rightEdgeBug) array_pop($tape);
var_dump($tape);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.1.7 0.003 0.005 17.19 7.1.6 0.004 0.008 17.29 7.1.5 0.063 0.013 33.18 7.1.4 0.070 0.003 32.32 7.1.3 0.057 0.010 32.64 7.1.2 0.043 0.017 32.82 7.1.1 0.030 0.013 14.71 7.1.0 0.037 0.007 14.70 7.0.20 0.006 0.009 16.77 7.0.19 0.057 0.010 14.84 7.0.18 0.030 0.013 14.27 7.0.17 0.073 0.007 14.28 7.0.16 0.050 0.010 14.27 7.0.15 0.033 0.007 14.27 7.0.14 0.040 0.007 14.43 7.0.13 0.047 0.010 14.57 7.0.12 0.033 0.013 14.42 7.0.11 0.050 0.003 14.40 7.0.10 0.087 0.010 14.21 7.0.9 0.043 0.020 14.59 7.0.8 0.030 0.017 14.51 7.0.7 0.033 0.013 14.42 7.0.6 0.037 0.013 14.07 7.0.5 0.040 0.007 14.57 7.0.4 0.033 0.010 14.61 7.0.3 0.033 0.007 14.57 7.0.2 0.033 0.013 14.46 7.0.1 0.030 0.013 14.42 7.0.0 0.053 0.007 14.30
preferences:dark mode live preview
38.62 ms | 400 KiB | 5 Q