3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // $v is some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; class MakeYourTime extends ArrayObject { public function __construct($test) { $this->test = $test; } public function __invoke() { $closure = function() { $this->secret = str_rot13($this->secret); }; return $closure->bindTo($this->test, 'Test'); } public function offsetGet($index) { return 'callbacks'; } } $test->cats = new MakeYourTime($test); echo $test->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   47     3        NEW                                              $5      'MakeYourTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN_OBJ                                               !0, 'cats'
          7        OP_DATA                                                  $5
   49     8        INIT_METHOD_CALL                                         !0, 'run'
          9        DO_FCALL                                      0  $7      
         10        ECHO                                                     $7
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FG1lCK%3A34%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_THIS                                       $0      
          1        INIT_FCALL                                               'str_rot13'
          2        FETCH_THIS                                       $2      
          3        FETCH_OBJ_R                                      ~3      $2, 'secret'
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
          6        ASSIGN_OBJ                                               $0, 'secret'
          7        OP_DATA                                                  $4
   36     8      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FG1lCK%3A34%240

Class Test:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  run
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      'callback'
          1        INIT_USER_CALL                                0          'call_user_func', ~0
          2        DO_FCALL                                      0          
   11     3        FETCH_OBJ_R                                      ~2      'secret'
          4        CONCAT                                           ~3      ~2, '%0A'
          5      > RETURN                                                   ~3
   12     6*     > RETURN                                                   null

End of function run

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  __set
number of ops:  11
compiled vars:  !0 = $k, !1 = $v, !2 = $key, !3 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        FETCH_DIM_R                                      ~4      !1, !1
          3        FETCH_DIM_R                                      ~5      !1, ~4
          4        ASSIGN                                                   !2, ~5
   17     5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !3, $7
   18     8        ASSIGN_OBJ                                               !2
          9        OP_DATA                                                  !3
   19    10      > RETURN                                                   null

End of function __set

End of class Test.

Class MakeYourTime:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  __construct
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        ASSIGN_OBJ                                               'test'
          2        OP_DATA                                                  !0
   30     3      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  __invoke
number of ops:  10
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FG1lCK%3A34%240'
          1        ASSIGN                                                   !0, ~1
   38     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $3      'test'
          5        SEND_FUNC_ARG                                            $3
          6        SEND_VAL_EX                                              'Test'
          7        DO_FCALL                                      0  $4      
          8      > RETURN                                                   $4
   39     9*     > RETURN                                                   null

End of function __invoke

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G1lCK
function name:  offsetGet
number of ops:  3
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   43     1      > RETURN                                                   'callbacks'
   44     2*     > RETURN                                                   null

End of function offsetget

End of class MakeYourTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.16 ms | 1400 KiB | 15 Q