3v4l.org

run code in 300+ PHP versions simultaneously
<?php class outer{ private $privateProp = 'Private'; protected $protectedProp = 'Protected'; public $publicProp = 'Public'; public function inner(){ return new class() extends outer{ public function returnProtected(){ return $this->protectedProp; } public function returnPrivate(){ return $this->privateProp; } }; } } $test = (new outer)->inner()->returnPrivate(); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkSqq
function name:  (null)
number of ops:  11
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   NEW                                              $1      'outer'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $1, 'inner'
          3        DO_FCALL                                      0  $3      
          4        INIT_METHOD_CALL                                         $3, 'returnPrivate'
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !0, $4
   35     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class outer@anonymous:
Function returnprotected:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkSqq
function name:  returnProtected
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'protectedProp'
          1      > RETURN                                                   ~0
   19     2*     > RETURN                                                   null

End of function returnprotected

Function returnprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkSqq
function name:  returnPrivate
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      'privateProp'
          1      > RETURN                                                   ~0
   25     2*     > RETURN                                                   null

End of function returnprivate

End of class outer@anonymous.

Class outer:
Function inner:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkSqq
function name:  inner
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_ANON_CLASS                               <ptr>   'outer'
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $1
   29     4*     > RETURN                                                   null

End of function inner

End of class outer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.42 ms | 1388 KiB | 15 Q