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; // $clfn = function(){ $this->secret = 'hello'; }; class Help{ public function __call($k, $v){ echo $v;echo $v;echo 'text';exit; } public function __contruct(){ echo 'ooo';exit; } } $this->secret = new Help(); $test = Closure::bind($clfn, $test, 'Test'); // end editing here echo $test->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gUC5Q
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test, !1 = $clfn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   32     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgUC5Q%3A32%240'
          4        ASSIGN                                                   !1, ~5
   48     5        FETCH_THIS                                       $7      
          6        NEW                                              $9      'Help'
          7        DO_FCALL                                      0          
          8        ASSIGN_OBJ                                               $7, 'secret'
          9        OP_DATA                                                  $9
   50    10        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         11        SEND_VAR                                                 !1
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'Test'
         14        DO_FCALL                                      0  $11     
         15        ASSIGN                                                   !0, $11
   54    16        INIT_METHOD_CALL                                         !0, 'run'
         17        DO_FCALL                                      0  $13     
         18        ECHO                                                     $13
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FgUC5Q%3A32%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gUC5Q
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                               $0, 'secret'
          2        OP_DATA                                                  'hello'
   35     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgUC5Q%3A32%240

Class Test:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gUC5Q
function name:  run
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'callback'
          1        INIT_USER_CALL                                0          'call_user_func', ~0
          2        DO_FCALL                                      0          
   12     3        FETCH_OBJ_R                                      ~2      'secret'
          4        CONCAT                                           ~3      ~2, '%0A'
          5      > RETURN                                                   ~3
   13     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/gUC5Q
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
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        FETCH_DIM_R                                      ~4      !1, !1
          3        FETCH_DIM_R                                      ~5      !1, ~4
          4        ASSIGN                                                   !2, ~5
   19     5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !3, $7
   20     8        ASSIGN_OBJ                                               !2
          9        OP_DATA                                                  !3
   21    10      > RETURN                                                   null

End of function __set

End of class Test.

Class Help:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/gUC5Q
function name:  __call
number of ops:  7
compiled vars:  !0 = $k, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   39     2        ECHO                                                     !1
          3        ECHO                                                     !1
          4        ECHO                                                     'text'
          5      > EXIT                                                     
   40     6*     > RETURN                                                   null

End of function __call

Function __contruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/gUC5Q
function name:  __contruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   ECHO                                                     'ooo'
          1      > EXIT                                                     
   44     2*     > RETURN                                                   null

End of function __contruct

End of class Help.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.85 ms | 1390 KiB | 13 Q