3v4l.org

run code in 500+ PHP versions simultaneously
<?php function R(&$X, $level) { print "$level X: " . json_encode($X) . "\n"; $A = $X; print "$level A before A: " . json_encode($A) . "\n"; foreach($A as $k => &$value) { $value = $value - 1; print "$level A during A $k: " . json_encode($A) . "\n"; } print "$level A after A: " . json_encode($A) . "\n"; print "$level X after A: " . json_encode($X) . "\n"; $B = $X; print "$level B before B: " . json_encode($B) . "\n"; foreach($B as $k => &$value) { $value = $value + 1; print "$level A during B $k: " . json_encode($A) . "\n"; print "$level B during B $k: " . json_encode($B) . "\n"; } print "$level A after B: " . json_encode($A) . "\n"; print "$level B after B: " . json_encode($B) . "\n"; print "$level X after B: " . json_encode($X) . "\n"; if ($level < 3) { R($B, $level + 1); } } $X = array(1, 2, 3); R($X, 0);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BPPTD
function name:  (null)
number of ops:  6
compiled vars:  !0 = $X
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                       !0, <array>
   29     1        INIT_FCALL                                                   'r'
          2        SEND_REF                                                     !0
          3        SEND_VAL                                                     0
          4        DO_FCALL                                          0          
          5      > RETURN                                                       1

Function r:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
2 jumps found. (Code = 126) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 35
2 jumps found. (Code = 125) Position 1 = 62, Position 2 = 87
Branch analysis from position: 62
2 jumps found. (Code = 126) Position 1 = 63, Position 2 = 87
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 119
Branch analysis from position: 114
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 119
Branch analysis from position: 87
Branch analysis from position: 35
filename:       /in/BPPTD
function name:  R
number of ops:  120
compiled vars:  !0 = $X, !1 = $level, !2 = $A, !3 = $value, !4 = $k, !5 = $B
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        NOP                                                          
          3        FAST_CONCAT                                          ~6      !1, '+X%3A+'
          4        INIT_FCALL                                                   'json_encode'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $7      
          7        CONCAT                                               ~8      ~6, $7
          8        CONCAT                                               ~9      ~8, '%0A'
          9        ECHO                                                         ~9
    5    10        ASSIGN                                                       !2, !0
    6    11        NOP                                                          
         12        FAST_CONCAT                                          ~11     !1, '+A+before+A%3A+'
         13        INIT_FCALL                                                   'json_encode'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                             $12     
         16        CONCAT                                               ~13     ~11, $12
         17        CONCAT                                               ~14     ~13, '%0A'
         18        ECHO                                                         ~14
    7    19      > FE_RESET_RW                                          $15     !2, ->35
         20    > > FE_FETCH_RW                                          ~16     $15, !3, ->35
         21    >   ASSIGN                                                       !4, ~16
    8    22        SUB                                                  ~18     !3, 1
         23        ASSIGN                                                       !3, ~18
    9    24        ROPE_INIT                                         4  ~21     !1
         25        ROPE_ADD                                          1  ~21     ~21, '+A+during+A+'
         26        ROPE_ADD                                          2  ~21     ~21, !4
         27        ROPE_END                                          3  ~20     ~21, '%3A+'
         28        INIT_FCALL                                                   'json_encode'
         29        SEND_VAR                                                     !2
         30        DO_ICALL                                             $23     
         31        CONCAT                                               ~24     ~20, $23
         32        CONCAT                                               ~25     ~24, '%0A'
         33        ECHO                                                         ~25
    7    34      > JMP                                                          ->20
         35    >   FE_FREE                                                      $15
   11    36        NOP                                                          
         37        FAST_CONCAT                                          ~26     !1, '+A+after+A%3A++'
         38        INIT_FCALL                                                   'json_encode'
         39        SEND_VAR                                                     !2
         40        DO_ICALL                                             $27     
         41        CONCAT                                               ~28     ~26, $27
         42        CONCAT                                               ~29     ~28, '%0A'
         43        ECHO                                                         ~29
   12    44        NOP                                                          
         45        FAST_CONCAT                                          ~30     !1, '+X+after+A%3A++'
         46        INIT_FCALL                                                   'json_encode'
         47        SEND_VAR                                                     !0
         48        DO_ICALL                                             $31     
         49        CONCAT                                               ~32     ~30, $31
         50        CONCAT                                               ~33     ~32, '%0A'
         51        ECHO                                                         ~33
   13    52        ASSIGN                                                       !5, !0
   14    53        NOP                                                          
         54        FAST_CONCAT                                          ~35     !1, '+B+before+B%3A+'
         55        INIT_FCALL                                                   'json_encode'
         56        SEND_VAR                                                     !5
         57        DO_ICALL                                             $36     
         58        CONCAT                                               ~37     ~35, $36
         59        CONCAT                                               ~38     ~37, '%0A'
         60        ECHO                                                         ~38
   15    61      > FE_RESET_RW                                          $39     !5, ->87
         62    > > FE_FETCH_RW                                          ~40     $39, !3, ->87
         63    >   ASSIGN                                                       !4, ~40
   16    64        ADD                                                  ~42     !3, 1
         65        ASSIGN                                                       !3, ~42
   17    66        ROPE_INIT                                         4  ~45     !1
         67        ROPE_ADD                                          1  ~45     ~45, '+A+during+B+'
         68        ROPE_ADD                                          2  ~45     ~45, !4
         69        ROPE_END                                          3  ~44     ~45, '%3A+'
         70        INIT_FCALL                                                   'json_encode'
         71        SEND_VAR                                                     !2
         72        DO_ICALL                                             $47     
         73        CONCAT                                               ~48     ~44, $47
         74        CONCAT                                               ~49     ~48, '%0A'
         75        ECHO                                                         ~49
   18    76        ROPE_INIT                                         4  ~51     !1
         77        ROPE_ADD                                          1  ~51     ~51, '+B+during+B+'
         78        ROPE_ADD                                          2  ~51     ~51, !4
         79        ROPE_END                                          3  ~50     ~51, '%3A+'
         80        INIT_FCALL                                                   'json_encode'
         81        SEND_VAR                                                     !5
         82        DO_ICALL                                             $53     
         83        CONCAT                                               ~54     ~50, $53
         84        CONCAT                                               ~55     ~54, '%0A'
         85        ECHO                                                         ~55
   15    86      > JMP                                                          ->62
         87    >   FE_FREE                                                      $39
   20    88        NOP                                                          
         89        FAST_CONCAT                                          ~56     !1, '+A+after+B%3A++'
         90        INIT_FCALL                                                   'json_encode'
         91        SEND_VAR                                                     !2
         92        DO_ICALL                                             $57     
         93        CONCAT                                               ~58     ~56, $57
         94        CONCAT                                               ~59     ~58, '%0A'
         95        ECHO                                                         ~59
   21    96        NOP                                                          
         97        FAST_CONCAT                                          ~60     !1, '+B+after+B%3A++'
         98        INIT_FCALL                                                   'json_encode'
         99        SEND_VAR                                                     !5
        100        DO_ICALL                                             $61     
        101        CONCAT                                               ~62     ~60, $61
        102        CONCAT                                               ~63     ~62, '%0A'
        103        ECHO                                                         ~63
   22   104        NOP                                                          
        105        FAST_CONCAT                                          ~64     !1, '+X+after+B%3A++'
        106        INIT_FCALL                                                   'json_encode'
        107        SEND_VAR                                                     !0
        108        DO_ICALL                                             $65     
        109        CONCAT                                               ~66     ~64, $65
        110        CONCAT                                               ~67     ~66, '%0A'
        111        ECHO                                                         ~67
   24   112        IS_SMALLER                                                   !1, 3
        113      > JMPZ                                                         ~68, ->119
   25   114    >   INIT_FCALL_BY_NAME                                           'R'
        115        SEND_VAR_EX                                                  !5
        116        ADD                                                  ~69     !1, 1
        117        SEND_VAL_EX                                                  ~69
        118        DO_FCALL                                          0          
   27   119    > > RETURN                                                       null

End of function r

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.55 ms | 3659 KiB | 15 Q