3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Outside { private $private = 'You should be able to see me'; public function getAnon() { return new class($this) { private $outside; public function __construct($outside) { $this->outside = $outside; } public function getPrivateOfOutside() { return $this->outside->private; } }; } } $foo = new Outside(); var_dump($foo->getAnon()->getPrivateOfOutside());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLFoJ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $1      'Outside'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   18     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'getAnon'
          5        DO_FCALL                                          0  $4      
          6        INIT_METHOD_CALL                                             $4, 'getPrivateOfOutside'
          7        DO_FCALL                                          0  $5      
          8        SEND_VAR                                                     $5
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

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

End of function __construct

Function getprivateofoutside:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLFoJ
function name:  getPrivateOfOutside
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                          ~0      'outside'
          1        FETCH_OBJ_R                                          ~1      ~0, 'private'
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of function getprivateofoutside

End of class class@anonymous.

Class Outside:
Function getanon:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLFoJ
function name:  getAnon
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_ANON_CLASS                                   <array> 
          1        NEW                                                  $1      $0
          2        FETCH_THIS                                           $2      
          3        SEND_VAR_EX                                                  $2
          4        DO_FCALL                                          0          
          5      > RETURN                                                       $1
   14     6*     > RETURN                                                       null

End of function getanon

End of class Outside.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.53 ms | 3350 KiB | 14 Q