3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $foo; protected $bar; public function toarray() { return get_object_vars($this); } } class inheritedTest extends test { private $baz; protected $baf; public function toarray() { return get_object_vars($this); } } $test=new Test(); $vars = $test->toarray(); //does acccess private, protected var_dump($vars); $itest= new inheritedTest(); $vars = $itest->toArray(); // does access protected but not private var_dump($vars);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5mKQ6
function name:  (null)
number of ops:  19
compiled vars:  !0 = $test, !1 = $vars, !2 = $itest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   31     3        INIT_METHOD_CALL                                         !0, 'toarray'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   32     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   34     9        NEW                                              $9      'inheritedTest'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $9
   35    12        INIT_METHOD_CALL                                         !2, 'toArray'
         13        DO_FCALL                                      0  $12     
         14        ASSIGN                                                   !1, $12
   36    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class test:
Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5mKQ6
function name:  toarray
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'get_object_vars'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   12     5*     > RETURN                                                   null

End of function toarray

End of class test.

Class inheritedTest:
Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5mKQ6
function name:  toarray
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'get_object_vars'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   24     5*     > RETURN                                                   null

End of function toarray

End of class inheritedTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.3 ms | 1396 KiB | 17 Q