3v4l.org

run code in 300+ PHP versions simultaneously
<?php $states = json_decode('[[[1,0,1],[1,1,0]],[[1,1],[1,0,1]]]'); $state = 0; $tape = array(1, 1, 1); $zend7lol = substr(phpversion(), 0, 1) == 7 && substr(phpversion(), -5) != '-hhvm'; $tape[] = 0; foreach ($tape as $k => &$v) { if (is_null($state)) { echo "stopping\n"; break; } var_dump($tape); @list ($v, $d, $state) = $states[$state][$v]; var_dump($tape); if ($d) { //var_dump(count($tape), $k); if (count($tape) - $k < 3) { $p = $tape; end($tape); $tape[] = 0; unset($p); } } elseif ($k) { $r = $tape; prev($r); if (!$zend7lol) prev($r); $tape = $r; unset($r); } else { array_unshift($tape, 0); if ($zend7lol) { $lol = $tape; reset($tape); unset($lol); } } } unset($v); var_dump($tape);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 125) Position 1 = 27, Position 2 = 87
Branch analysis from position: 27
2 jumps found. (Code = 126) Position 1 = 28, Position 2 = 87
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 63
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 62
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 62
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 76
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 73
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 73
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 86
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 86
Branch analysis from position: 87
Branch analysis from position: 87
Branch analysis from position: 23
filename:       /in/AO41K
function name:  (null)
number of ops:  93
compiled vars:  !0 = $states, !1 = $state, !2 = $tape, !3 = $zend7lol, !4 = $v, !5 = $k, !6 = $d, !7 = $p, !8 = $r, !9 = $lol
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%5B%5B1%2C0%2C1%5D%2C%5B1%2C1%2C0%5D%5D%2C%5B%5B1%2C1%5D%2C%5B1%2C0%2C1%5D%5D%5D'
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !0, $10
    4     4        ASSIGN                                                   !1, 0
    5     5        ASSIGN                                                   !2, <array>
    7     6        INIT_FCALL                                               'substr'
          7        INIT_FCALL                                               'phpversion'
          8        DO_ICALL                                         $14     
          9        SEND_VAR                                                 $14
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $15     
         13        IS_EQUAL                                         ~16     $15, 7
         14      > JMPZ_EX                                          ~16     ~16, ->23
    8    15    >   INIT_FCALL                                               'substr'
         16        INIT_FCALL                                               'phpversion'
         17        DO_ICALL                                         $17     
         18        SEND_VAR                                                 $17
         19        SEND_VAL                                                 -5
         20        DO_ICALL                                         $18     
         21        IS_NOT_EQUAL                                     ~19     $18, '-hhvm'
         22        BOOL                                             ~16     ~19
    7    23    >   ASSIGN                                                   !3, ~16
    9    24        ASSIGN_DIM                                               !2
         25        OP_DATA                                                  0
   10    26      > FE_RESET_RW                                      $22     !2, ->87
         27    > > FE_FETCH_RW                                      ~23     $22, !4, ->87
         28    >   ASSIGN                                                   !5, ~23
   11    29        TYPE_CHECK                                    2          !1
         30      > JMPZ                                                     ~25, ->33
   12    31    >   ECHO                                                     'stopping%0A'
   13    32      > JMP                                                      ->87
   15    33    >   INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                                 
   16    36        BEGIN_SILENCE                                    ~27     
         37        FETCH_DIM_R                                      ~28     !0, !1
         38        FETCH_DIM_R                                      ~29     ~28, !4
         39        FETCH_LIST_R                                     $30     ~29, 0
         40        ASSIGN                                                   !4, $30
         41        FETCH_LIST_R                                     $32     ~29, 1
         42        ASSIGN                                                   !6, $32
         43        FETCH_LIST_R                                     $34     ~29, 2
         44        ASSIGN                                                   !1, $34
         45        END_SILENCE                                              ~27
         46        FREE                                                     ~29
   17    47        INIT_FCALL                                               'var_dump'
         48        SEND_VAR                                                 !2
         49        DO_ICALL                                                 
   18    50      > JMPZ                                                     !6, ->63
   20    51    >   COUNT                                            ~37     !2
         52        SUB                                              ~38     ~37, !5
         53        IS_SMALLER                                               ~38, 3
         54      > JMPZ                                                     ~39, ->62
   21    55    >   ASSIGN                                                   !7, !2
   22    56        INIT_FCALL                                               'end'
         57        SEND_REF                                                 !2
         58        DO_ICALL                                                 
   23    59        ASSIGN_DIM                                               !2
         60        OP_DATA                                                  0
   24    61        UNSET_CV                                                 !7
         62    > > JMP                                                      ->86
   26    63    > > JMPZ                                                     !5, ->76
   27    64    >   ASSIGN                                                   !8, !2
         65        INIT_FCALL                                               'prev'
         66        SEND_REF                                                 !8
         67        DO_ICALL                                                 
         68        BOOL_NOT                                         ~45     !3
         69      > JMPZ                                                     ~45, ->73
         70    >   INIT_FCALL                                               'prev'
         71        SEND_REF                                                 !8
         72        DO_ICALL                                                 
         73    >   ASSIGN                                                   !2, !8
         74        UNSET_CV                                                 !8
         75      > JMP                                                      ->86
   29    76    >   INIT_FCALL                                               'array_unshift'
         77        SEND_REF                                                 !2
         78        SEND_VAL                                                 0
         79        DO_ICALL                                                 
   30    80      > JMPZ                                                     !3, ->86
   31    81    >   ASSIGN                                                   !9, !2
   32    82        INIT_FCALL                                               'reset'
         83        SEND_REF                                                 !2
         84        DO_ICALL                                                 
   33    85        UNSET_CV                                                 !9
   10    86    > > JMP                                                      ->27
         87    >   FE_FREE                                                  $22
   37    88        UNSET_CV                                                 !4
   38    89        INIT_FCALL                                               'var_dump'
         90        SEND_VAR                                                 !2
         91        DO_ICALL                                                 
         92      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.01 ms | 1404 KiB | 29 Q