3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ServiceLocator { public function __get($name) { echo __METHOD__ . " called.\n"; if ($name == 'a') { return new A(); } else { return null; } } public function __isset($name) { echo __METHOD__ . " called.\n"; if ($name == 'a') { return true; } else { return false; } } } class A { public function __get($name) { echo __METHOD__ . " called.\n"; return 'a'; } public function __isset($name) { echo __METHOD__ . " called.\n"; return true; } } $s = new ServiceLocator; isset($s->a->name); echo "---\n"; isset($s->b->name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEUfg
function name:  (null)
number of ops:  11
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   NEW                                              $1      'ServiceLocator'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   43     3        FETCH_OBJ_IS                                     ~4      !0, 'a'
          4        ISSET_ISEMPTY_PROP_OBJ                           ~5      ~4, 'name'
          5        FREE                                                     ~5
   44     6        ECHO                                                     '---%0A'
   45     7        FETCH_OBJ_IS                                     ~6      !0, 'b'
          8        ISSET_ISEMPTY_PROP_OBJ                           ~7      ~6, 'name'
          9        FREE                                                     ~7
         10      > RETURN                                                   1

Class ServiceLocator:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEUfg
function name:  __get
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ECHO                                                     'ServiceLocator%3A%3A__get+called.%0A'
    8     2        IS_EQUAL                                                 !0, 'a'
          3      > JMPZ                                                     ~1, ->8
    9     4    >   NEW                                              $2      'A'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
    8     7*       JMP                                                      ->9
   11     8    > > RETURN                                                   null
   13     9*     > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEUfg
function name:  __isset
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ECHO                                                     'ServiceLocator%3A%3A__isset+called.%0A'
   18     2        IS_EQUAL                                                 !0, 'a'
          3      > JMPZ                                                     ~1, ->6
   19     4    > > RETURN                                                   <true>
   18     5*       JMP                                                      ->7
   21     6    > > RETURN                                                   <false>
   23     7*     > RETURN                                                   null

End of function __isset

End of class ServiceLocator.

Class A:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEUfg
function name:  __get
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        ECHO                                                     'A%3A%3A__get+called.%0A'
   31     2      > RETURN                                                   'a'
   32     3*     > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEUfg
function name:  __isset
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        ECHO                                                     'A%3A%3A__isset+called.%0A'
   37     2      > RETURN                                                   <true>
   38     3*     > RETURN                                                   null

End of function __isset

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.24 ms | 1012 KiB | 13 Q