3v4l.org

run code in 300+ PHP versions simultaneously
<?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; $noticesPointerOnlyMutation = true; $rightEdgeBug = false; } elseif (substr(phpversion(), 0, 1) == 7) { $updatesInternalPointer = false; $noticesPointerOnlyMutation = true; $rightEdgeBug = false; } else { $updatesInternalPointer = true; $noticesPointerOnlyMutation = false; $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; if ($noticesPointerOnlyMutation) { prev($tape); if ($updatesInternalPointer) prev($tape); } else { 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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
2 jumps found. (Code = 125) Position 1 = 38, Position 2 = 104
Branch analysis from position: 38
2 jumps found. (Code = 126) Position 1 = 39, Position 2 = 104
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 110
Branch analysis from position: 107
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 110
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 71
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 60
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 70
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 70
Branch analysis from position: 65
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
Branch analysis from position: 65
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 92
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 82
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 81
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 90
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
Branch analysis from position: 81
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 89
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
Branch analysis from position: 89
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 98, Position 2 = 103
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 103
Branch analysis from position: 104
Branch analysis from position: 104
Branch analysis from position: 37
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
filename:       /in/5e5uJ
function name:  (null)
number of ops:  114
compiled vars:  !0 = $states, !1 = $state, !2 = $tape, !3 = $updatesInternalPointer, !4 = $noticesPointerOnlyMutation, !5 = $rightEdgeBug, !6 = $v, !7 = $k, !8 = $d, !9 = $lol
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%5B%5B2%2C0%2C1%5D%2C%5B1%2C1%2C0%5D%5D%2C%5B%5B4%2C1%2C2%5D%2C%5B3%2C0%2C1%5D%5D%2C%5B%5B99%2C0%5D%2C%5B99%2C0%5D%2C%5B22%2C0%5D%2C%5B33%2C1%2C2%5D%5D%5D'
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !0, $10
    5     4        ASSIGN                                                   !1, 0
    6     5        ASSIGN                                                   !2, <array>
    8     6        INIT_FCALL                                               'substr'
          7        INIT_FCALL                                               'phpversion'
          8        DO_ICALL                                         $14     
          9        SEND_VAR                                                 $14
         10        SEND_VAL                                                 -5
         11        DO_ICALL                                         $15     
         12        IS_EQUAL                                                 $15, '-hhvm'
         13      > JMPZ                                                     ~16, ->18
    9    14    >   ASSIGN                                                   !3, <true>
   10    15        ASSIGN                                                   !4, <true>
   11    16        ASSIGN                                                   !5, <false>
         17      > JMP                                                      ->34
   12    18    >   INIT_FCALL                                               'substr'
         19        INIT_FCALL                                               'phpversion'
         20        DO_ICALL                                         $20     
         21        SEND_VAR                                                 $20
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 1
         24        DO_ICALL                                         $21     
         25        IS_EQUAL                                                 $21, 7
         26      > JMPZ                                                     ~22, ->31
   13    27    >   ASSIGN                                                   !3, <false>
   14    28        ASSIGN                                                   !4, <true>
   15    29        ASSIGN                                                   !5, <false>
         30      > JMP                                                      ->34
   17    31    >   ASSIGN                                                   !3, <true>
   18    32        ASSIGN                                                   !4, <false>
   19    33        ASSIGN                                                   !5, <true>
   22    34    > > JMPZ                                                     !5, ->37
         35    >   ASSIGN_DIM                                               !2
         36        OP_DATA                                                  0
   23    37    > > FE_RESET_RW                                      $30     !2, ->104
         38    > > FE_FETCH_RW                                      ~31     $30, !6, ->104
         39    >   ASSIGN                                                   !7, ~31
   24    40        TYPE_CHECK                                    2          !1
         41      > JMPZ                                                     ~33, ->43
         42    > > JMP                                                      ->104
   25    43    >   BEGIN_SILENCE                                    ~34     
         44        FETCH_DIM_R                                      ~35     !0, !1
         45        FETCH_DIM_R                                      ~36     ~35, !6
         46        FETCH_LIST_R                                     $37     ~36, 0
         47        ASSIGN                                                   !6, $37
         48        FETCH_LIST_R                                     $39     ~36, 1
         49        ASSIGN                                                   !8, $39
         50        FETCH_LIST_R                                     $41     ~36, 2
         51        ASSIGN                                                   !1, $41
         52        END_SILENCE                                              ~34
         53        FREE                                                     ~36
   26    54      > JMPZ                                                     !8, ->71
   27    55    >   COUNT                                            ~43     !2
         56        SUB                                              ~44     ~43, !7
         57      > JMPZ                                                     !5, ->60
         58    >   QM_ASSIGN                                        ~45     3
         59      > JMP                                                      ->61
         60    >   QM_ASSIGN                                        ~45     2
         61    >   IS_SMALLER                                               ~44, ~45
         62      > JMPZ                                                     ~46, ->65
         63    >   ASSIGN_DIM                                               !2
         64        OP_DATA                                                  0
   28    65    >   BOOL_NOT                                         ~48     !3
         66      > JMPZ                                                     ~48, ->70
         67    >   INIT_FCALL                                               'next'
         68        SEND_REF                                                 !2
         69        DO_ICALL                                                 
         70    > > JMP                                                      ->103
   29    71    > > JMPZ                                                     !7, ->92
   30    72    >   ASSIGN                                                   !9, !2
   31    73      > JMPZ                                                     !4, ->82
   32    74    >   INIT_FCALL                                               'prev'
         75        SEND_REF                                                 !2
         76        DO_ICALL                                                 
   33    77      > JMPZ                                                     !3, ->81
         78    >   INIT_FCALL                                               'prev'
         79        SEND_REF                                                 !2
         80        DO_ICALL                                                 
         81    > > JMP                                                      ->90
   35    82    >   INIT_FCALL                                               'prev'
         83        SEND_REF                                                 !9
         84        DO_ICALL                                                 
   36    85      > JMPZ                                                     !3, ->89
         86    >   INIT_FCALL                                               'prev'
         87        SEND_REF                                                 !9
         88        DO_ICALL                                                 
   37    89    >   ASSIGN                                                   !2, !9
   39    90    >   UNSET_CV                                                 !9
         91      > JMP                                                      ->103
   41    92    >   INIT_FCALL                                               'array_unshift'
         93        SEND_REF                                                 !2
         94        SEND_VAL                                                 0
         95        DO_ICALL                                                 
   42    96        BOOL_NOT                                         ~57     !3
         97      > JMPZ                                                     ~57, ->103
   43    98    >   ASSIGN                                                   !9, !2
   44    99        INIT_FCALL                                               'reset'
        100        SEND_REF                                                 !2
        101        DO_ICALL                                                 
   45   102        UNSET_CV                                                 !9
   23   103    > > JMP                                                      ->38
        104    >   FE_FREE                                                  $30
   49   105        UNSET_CV                                                 !6
   50   106      > JMPZ                                                     !5, ->110
        107    >   INIT_FCALL                                               'array_pop'
        108        SEND_REF                                                 !2
        109        DO_ICALL                                                 
   51   110    >   INIT_FCALL                                               'var_dump'
        111        SEND_VAR                                                 !2
        112        DO_ICALL                                                 
        113      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.66 ms | 1408 KiB | 31 Q