3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(ticks=1); function tick() { global $ticks; if ($ticks) { if ($ticks[0][0] > 1) { $ticks[0][0]--; } else { $tick = array_shift($ticks); $tick[1](); } } } register_tick_function('tick'); class A { protected $b = ['d' => 321]; function & __get($name) { $current = $this->{$name}; echo "And now, __get is running...\n"; $GLOBALS['ticks'][] = [2, function () use ($current, $name) { if ($current !== $this->{$name}) { echo "Array WAS changed!!!\n"; } else { echo "Array not changed.\n"; } }]; return $this->{$name}; } } eval(' $a = new A(); $a->b["c"] = 123; var_dump($a->b); ');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb5jH
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   TICKS                                                    
   16     1        INIT_FCALL                                               'register_tick_function'
          2        SEND_VAL                                                 'tick'
          3        DO_ICALL                                                 
          4        TICKS                                                    
   39     5        INCLUDE_OR_EVAL                                          '%0A%24a+%3D+new+A%28%29%3B%0A%24a-%3Eb%5B%22c%22%5D+%3D+123%3B+%0Avar_dump%28%24a-%3Eb%29%3B%0A', EVAL
          6        TICKS                                                    
   43     7      > RETURN                                                   1

Function tick:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/Cb5jH
function name:  tick
number of ops:  22
compiled vars:  !0 = $ticks, !1 = $tick
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_GLOBAL                                              !0, 'ticks'
          1        TICKS                                                    
    6     2      > JMPZ                                                     !0, ->21
    7     3    >   FETCH_DIM_R                                      ~2      !0, 0
          4        FETCH_DIM_R                                      ~3      ~2, 0
          5        IS_SMALLER                                               1, ~3
          6      > JMPZ                                                     ~4, ->12
    8     7    >   FETCH_DIM_RW                                     $5      !0, 0
          8        FETCH_DIM_RW                                     $6      $5, 0
          9        PRE_DEC                                                  $6
         10        TICKS                                                    
         11      > JMP                                                      ->21
   10    12    >   INIT_FCALL                                               'array_shift'
         13        SEND_REF                                                 !0
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !1, $8
         16        TICKS                                                    
   11    17        FETCH_DIM_R                                      ~10     !1, 1
         18        INIT_DYNAMIC_CALL                                        ~10
         19        DO_FCALL                                      0          
         20        TICKS                                                    
   14    21    > > RETURN                                                   null

End of function tick

Function %00%7Bclosure%7D%2Fin%2FCb5jH%3A27%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb5jH
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $current, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   28     2        FETCH_THIS                                       $2      
          3        FETCH_OBJ_R                                      ~3      $2, !1
          4        IS_NOT_IDENTICAL                                         !0, ~3
          5      > JMPZ                                                     ~4, ->9
   29     6    >   ECHO                                                     'Array+WAS+changed%21%21%21%0A'
          7        TICKS                                                    
          8      > JMP                                                      ->11
   31     9    >   ECHO                                                     'Array+not+changed.%0A'
         10        TICKS                                                    
   33    11    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCb5jH%3A27%240

Class A:
Function __get:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/Cb5jH
function name:  __get
number of ops:  20
compiled vars:  !0 = $name, !1 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        FETCH_OBJ_R                                      ~2      !0
          2        ASSIGN                                                   !1, ~2
          3        TICKS                                                    
   26     4        ECHO                                                     'And+now%2C+__get+is+running...%0A'
          5        TICKS                                                    
   27     6        INIT_ARRAY                                       ~7      2
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCb5jH%3A27%240'
          8        BIND_LEXICAL                                             ~8, !1
          9        BIND_LEXICAL                                             ~8, !0
   33    10        ADD_ARRAY_ELEMENT                                ~7      ~8
   27    11        FETCH_W                      global              $4      'GLOBALS'
         12        FETCH_DIM_W                                      $5      $4, 'ticks'
         13        ASSIGN_DIM                                               $5
   33    14        OP_DATA                                                  ~7
         15        TICKS                                                    
   35    16        FETCH_OBJ_W                                      $9      !0
         17      > RETURN_BY_REF                                            $9
         18*       TICKS                                                    
   36    19*     > RETURN_BY_REF                                            null

End of function __get

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.53 ms | 1400 KiB | 17 Q