3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $private = 0; public function addPrivate() { $this->private++; } public function getPrivate() { return $this->private; } } class B extends A { public $private = 10; public function addBPrivate($private) { $this->private++; } public function getPrivate() { return $this->private; } } $a = new A(); $a->addPrivate(); var_dump($a->getPrivate()); $b = new B(); $b->addPrivate(); var_dump($b->getPrivate()); $b->addBPrivate(); var_dump($b->getPrivate());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f7KtG
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   34     3        INIT_METHOD_CALL                                         !0, 'addPrivate'
          4        DO_FCALL                                      0          
   35     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getPrivate'
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
   37    10        NEW                                              $8      'B'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $8
   38    13        INIT_METHOD_CALL                                         !1, 'addPrivate'
         14        DO_FCALL                                      0          
   39    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !1, 'getPrivate'
         17        DO_FCALL                                      0  $12     
         18        SEND_VAR                                                 $12
         19        DO_ICALL                                                 
   40    20        INIT_METHOD_CALL                                         !1, 'addBPrivate'
         21        DO_FCALL                                      0          
   41    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !1, 'getPrivate'
         24        DO_FCALL                                      0  $15     
         25        SEND_VAR                                                 $15
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class A:
Function addprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f7KtG
function name:  addPrivate
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   PRE_INC_OBJ                                              'private'
   10     1      > RETURN                                                   null

End of function addprivate

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

End of function getprivate

End of class A.

Class B:
Function addbprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f7KtG
function name:  addBPrivate
number of ops:  3
compiled vars:  !0 = $private
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        PRE_INC_OBJ                                              'private'
   25     2      > RETURN                                                   null

End of function addbprivate

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

End of function getprivate

Function addprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f7KtG
function name:  addPrivate
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   PRE_INC_OBJ                                              'private'
   10     1      > RETURN                                                   null

End of function addprivate

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.71 ms | 1400 KiB | 15 Q