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; $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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 125) Position 1 = 35, Position 2 = 92
Branch analysis from position: 35
2 jumps found. (Code = 126) Position 1 = 36, Position 2 = 92
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 40
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 98
Branch analysis from position: 95
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 98
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 68
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 57
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 67
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 67
Branch analysis from position: 62
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
Branch analysis from position: 62
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 80
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 77
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
Branch analysis from position: 77
Branch analysis from position: 80
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 91
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 91
Branch analysis from position: 92
Branch analysis from position: 92
Branch analysis from position: 34
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
Branch analysis from position: 34
filename:       /in/kNkVO
function name:  (null)
number of ops:  102
compiled vars:  !0 = $states, !1 = $state, !2 = $tape, !3 = $updatesInternalPointer, !4 = $rightEdgeBug, !5 = $v, !6 = $k, !7 = $d, !8 = $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                                         $9      
          3        ASSIGN                                                   !0, $9
    5     4        ASSIGN                                                   !1, 0
    6     5        ASSIGN                                                   !2, <array>
    8     6        INIT_FCALL                                               'substr'
          7        INIT_FCALL                                               'phpversion'
          8        DO_ICALL                                         $13     
          9        SEND_VAR                                                 $13
         10        SEND_VAL                                                 -5
         11        DO_ICALL                                         $14     
         12        IS_EQUAL                                                 $14, '-hhvm'
         13      > JMPZ                                                     ~15, ->17
    9    14    >   ASSIGN                                                   !3, <true>
   10    15        ASSIGN                                                   !4, <false>
         16      > JMP                                                      ->31
   11    17    >   INIT_FCALL                                               'substr'
         18        INIT_FCALL                                               'phpversion'
         19        DO_ICALL                                         $18     
         20        SEND_VAR                                                 $18
         21        SEND_VAL                                                 0
         22        SEND_VAL                                                 1
         23        DO_ICALL                                         $19     
         24        IS_EQUAL                                                 $19, 7
         25      > JMPZ                                                     ~20, ->29
   12    26    >   ASSIGN                                                   !3, <false>
   13    27        ASSIGN                                                   !4, <false>
         28      > JMP                                                      ->31
   15    29    >   ASSIGN                                                   !3, <true>
   16    30        ASSIGN                                                   !4, <true>
   19    31    > > JMPZ                                                     !4, ->34
         32    >   ASSIGN_DIM                                               !2
         33        OP_DATA                                                  0
   20    34    > > FE_RESET_RW                                      $26     !2, ->92
         35    > > FE_FETCH_RW                                      ~27     $26, !5, ->92
         36    >   ASSIGN                                                   !6, ~27
   21    37        TYPE_CHECK                                    2          !1
         38      > JMPZ                                                     ~29, ->40
         39    > > JMP                                                      ->92
   22    40    >   BEGIN_SILENCE                                    ~30     
         41        FETCH_DIM_R                                      ~31     !0, !1
         42        FETCH_DIM_R                                      ~32     ~31, !5
         43        FETCH_LIST_R                                     $33     ~32, 0
         44        ASSIGN                                                   !5, $33
         45        FETCH_LIST_R                                     $35     ~32, 1
         46        ASSIGN                                                   !7, $35
         47        FETCH_LIST_R                                     $37     ~32, 2
         48        ASSIGN                                                   !1, $37
         49        END_SILENCE                                              ~30
         50        FREE                                                     ~32
   23    51      > JMPZ                                                     !7, ->68
   24    52    >   COUNT                                            ~39     !2
         53        SUB                                              ~40     ~39, !6
         54      > JMPZ                                                     !4, ->57
         55    >   QM_ASSIGN                                        ~41     3
         56      > JMP                                                      ->58
         57    >   QM_ASSIGN                                        ~41     2
         58    >   IS_SMALLER                                               ~40, ~41
         59      > JMPZ                                                     ~42, ->62
         60    >   ASSIGN_DIM                                               !2
         61        OP_DATA                                                  0
   25    62    >   BOOL_NOT                                         ~44     !3
         63      > JMPZ                                                     ~44, ->67
         64    >   INIT_FCALL                                               'next'
         65        SEND_REF                                                 !2
         66        DO_ICALL                                                 
         67    > > JMP                                                      ->91
   26    68    > > JMPZ                                                     !6, ->80
   27    69    >   ASSIGN                                                   !8, !2
   30    70        INIT_FCALL                                               'prev'
         71        SEND_REF                                                 !8
         72        DO_ICALL                                                 
   31    73      > JMPZ                                                     !3, ->77
         74    >   INIT_FCALL                                               'prev'
         75        SEND_REF                                                 !8
         76        DO_ICALL                                                 
   32    77    >   ASSIGN                                                   !2, !8
   33    78        UNSET_CV                                                 !8
         79      > JMP                                                      ->91
   35    80    >   INIT_FCALL                                               'array_unshift'
         81        SEND_REF                                                 !2
         82        SEND_VAL                                                 0
         83        DO_ICALL                                                 
   36    84        BOOL_NOT                                         ~51     !3
         85      > JMPZ                                                     ~51, ->91
   37    86    >   ASSIGN                                                   !8, !2
   38    87        INIT_FCALL                                               'reset'
         88        SEND_REF                                                 !2
         89        DO_ICALL                                                 
   39    90        UNSET_CV                                                 !8
   20    91    > > JMP                                                      ->35
         92    >   FE_FREE                                                  $26
   43    93        UNSET_CV                                                 !5
   44    94      > JMPZ                                                     !4, ->98
         95    >   INIT_FCALL                                               'array_pop'
         96        SEND_REF                                                 !2
         97        DO_ICALL                                                 
   45    98    >   INIT_FCALL                                               'var_dump'
         99        SEND_VAR                                                 !2
        100        DO_ICALL                                                 
        101      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.88 ms | 1404 KiB | 31 Q