3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Priv { public $public = 1; private $private2 = 1; public function getPrivate() { return $this->private; } } class Override extends Priv { protected $private2 = 2; public function getPrivate() { return $this->public + $this->private2; } } $priv = new Priv(); var_dump($priv->getPrivate()); $override = new Override(); var_dump($override->getPrivate());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/goEgi
function name:  (null)
number of ops:  17
compiled vars:  !0 = $priv, !1 = $override
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $2      'Priv'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   25     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getPrivate'
          5        DO_FCALL                                      0  $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                                 
   27     8        NEW                                              $7      'Override'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   28    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'getPrivate'
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Priv:
Function getprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/goEgi
function name:  getPrivate
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      'private'
          1      > RETURN                                                   ~0
   11     2*     > RETURN                                                   null

End of function getprivate

End of class Priv.

Class Override:
Function getprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/goEgi
function name:  getPrivate
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      'public'
          1        FETCH_OBJ_R                                      ~1      'private2'
          2        ADD                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   21     4*     > RETURN                                                   null

End of function getprivate

End of class Override.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.91 ms | 1396 KiB | 15 Q