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; // start editing here class C implements ArrayAccess { public $key = false; public function offsetGet($offset) { return $this->key ? "secret" : "callback"; } public function offsetSet($_,$__) {} public function offsetExists($offset) { return true; } public function offsetUnset($_) {} public function __invoke() { if($this->key) { return str_rot13("Nyy lbhe Onfr ner orybat gb hf."); } else { return function() {}; } } } $c = new C(); $test->blah = $c; $c->key = true; $test->blah = $c; // end editing here echo $test->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  (null)
number of ops:  17
compiled vars:  !0 = $test, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        DECLARE_CLASS                                            'c'
   46     4        NEW                                              $5      'C'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   47     7        ASSIGN_OBJ                                               !0, 'blah'
          8        OP_DATA                                                  !1
   48     9        ASSIGN_OBJ                                               !1, 'key'
         10        OP_DATA                                                  <true>
   49    11        ASSIGN_OBJ                                               !0, 'blah'
         12        OP_DATA                                                  !1
   52    13        INIT_METHOD_CALL                                         !0, 'run'
         14        DO_FCALL                                      0  $11     
         15        ECHO                                                     $11
         16      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2Fu8oMl%3A40%240

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

End of function __set

End of class Test.

Class C:
Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  offsetGet
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        FETCH_OBJ_R                                      ~1      'key'
          2      > JMPZ                                                     ~1, ->5
          3    >   QM_ASSIGN                                        ~2      'secret'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      'callback'
          6    > > RETURN                                                   ~2
   27     7*     > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  offsetSet
number of ops:  3
compiled vars:  !0 = $_, !1 = $__
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function offsetset

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  offsetExists
number of ops:  3
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1      > RETURN                                                   <true>
   32     2*     > RETURN                                                   null

End of function offsetexists

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  offsetUnset
number of ops:  2
compiled vars:  !0 = $_
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function offsetunset

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u8oMl
function name:  __invoke
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~0      'key'
          1      > JMPZ                                                     ~0, ->7
   38     2    >   INIT_FCALL                                               'str_rot13'
          3        SEND_VAL                                                 'Nyy+lbhe+Onfr+ner+orybat+gb+hf.'
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*       JMP                                                      ->9
   40     7    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fu8oMl%3A40%240'
          8      > RETURN                                                   ~2
   42     9*     > RETURN                                                   null

End of function __invoke

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.34 ms | 1404 KiB | 15 Q