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; } }; } } $test = (new outer)->inner()->returnProtected(); var_dump($test->protectedProp);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Q8dC
function name:  (null)
number of ops:  12
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     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, 'returnProtected'
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !0, $4
   29     7        INIT_FCALL                                               'var_dump'
          8        FETCH_OBJ_R                                      ~6      !0, 'protectedProp'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
         11      > 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/4Q8dC
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

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/4Q8dC
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
   23     4*     > RETURN                                                   null

End of function inner

End of class outer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.21 ms | 1395 KiB | 15 Q