3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __get($prop) { echo 'Base: ' . $prop . "\n"; } } class bar extends foo { function __get($prop) { if (strpos('_', $prop) !== false) { parent::__get($prop); } else { echo 'Extended: ' . $prop . "\n"; } } } $b = new bar; $b->test; $b->_test;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbCSq
function name:  (null)
number of ops:  8
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        FETCH_OBJ_R                                      ~4      !0, 'test'
          4        FREE                                                     ~4
   22     5        FETCH_OBJ_R                                      ~5      !0, '_test'
          6        FREE                                                     ~5
          7      > RETURN                                                   1

Class foo:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbCSq
function name:  __get
number of ops:  5
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        CONCAT                                           ~1      'Base%3A+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
    6     4      > RETURN                                                   null

End of function __get

End of class foo.

Class bar:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbCSq
function name:  __get
number of ops:  15
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'strpos'
          2        SEND_VAL                                                 '_'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        TYPE_CHECK                                  1018          $1
          6      > JMPZ                                                     ~2, ->11
   12     7    >   INIT_STATIC_METHOD_CALL                                  '__get'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10      > JMP                                                      ->14
   14    11    >   CONCAT                                           ~4      'Extended%3A+', !0
         12        CONCAT                                           ~5      ~4, '%0A'
         13        ECHO                                                     ~5
   16    14    > > RETURN                                                   null

End of function __get

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.21 ms | 1396 KiB | 15 Q