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[0]; $value = $v(); $this->{$key} = $value; } } $test = new Test; // start editing here class Fixer extends ArrayObject { public function offsetGet($i) { return 'callback'; } public function __invoke() { $fix = function() { $this->secret = str_rot13($this->secret); }; return $fix->bindTo($GLOBALS['test'], 'Test'); } } $test->foo = new Fixer; // end editing here echo $test->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCdqR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   45     3        NEW                                              $5      'Fixer'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               !0, 'foo'
          6        OP_DATA                                                  $5
   49     7        INIT_METHOD_CALL                                         !0, 'run'
          8        DO_FCALL                                      0  $7      
          9        ECHO                                                     $7
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FnCdqR%3A38%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCdqR
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     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
   40     8      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnCdqR%3A38%240

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

End of function __set

End of class Test.

Class Fixer:
Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nCdqR
function name:  offsetGet
number of ops:  3
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1      > RETURN                                                   'callback'
   34     2*     > RETURN                                                   null

End of function offsetget

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

End of function __invoke

End of class Fixer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.92 ms | 1400 KiB | 15 Q