3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testClass { protected $config; public function getConfiguration() { $this->config = new section; } public function __get($name) { echo "magic method has been called, name is $name\n"; $method = "get".ucfirst($name); return method_exists($this, $method) ? $this->$method() : null; } public function test() { var_dump(empty($this->configuration->name)); var_dump($this->configuration); } } class section { protected $vars; public function __contstruct() { $this->vars = [ 'name' => 1, 'val' => 2 ]; } public function __get($name) { return isset($this->vars[$name]) ? $this->vars[$name] : null; } public function __isset($name) { return isset($this->vars[$name]); } } $a = new testClass; $a -> test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   NEW                                              $1      'testClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   43     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class testClass:
Function getconfiguration:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  getConfiguration
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'section'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'config'
          3        OP_DATA                                                  $1
   10     4      > RETURN                                                   null

End of function getconfiguration

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  __get
number of ops:  23
compiled vars:  !0 = $name, !1 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        ROPE_INIT                                     3  ~3      'magic+method+has+been+called%2C+name+is+'
          2        ROPE_ADD                                      1  ~3      ~3, !0
          3        ROPE_END                                      2  ~2      ~3, '%0A'
          4        ECHO                                                     ~2
   14     5        INIT_FCALL                                               'ucfirst'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        CONCAT                                           ~6      'get', $5
          9        ASSIGN                                                   !1, ~6
   15    10        INIT_FCALL                                               'method_exists'
         11        FETCH_THIS                                       ~8      
         12        SEND_VAL                                                 ~8
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15      > JMPZ                                                     $9, ->20
         16    >   INIT_METHOD_CALL                                         !1
         17        DO_FCALL                                      0  $10     
         18        QM_ASSIGN                                        ~11     $10
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~11     null
         21    > > RETURN                                                   ~11
   16    22*     > RETURN                                                   null

End of function __get

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  test
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_IS                                     ~0      'configuration'
          2        ISSET_ISEMPTY_PROP_OBJ                           ~1      ~0, 'name'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   20     5        INIT_FCALL                                               'var_dump'
          6        FETCH_OBJ_R                                      ~3      'configuration'
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
   21     9      > RETURN                                                   null

End of function test

End of class testClass.

Class section:
Function __contstruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  __contstruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   ASSIGN_OBJ                                               'vars'
   28     1        OP_DATA                                                  <array>
   31     2      > RETURN                                                   null

End of function __contstruct

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 = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sp7P7
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   33     1        FETCH_OBJ_IS                                     ~1      'vars'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'vars'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      null
          9    > > RETURN                                                   ~5
   34    10*     > 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/Sp7P7
function name:  __isset
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        FETCH_OBJ_IS                                     ~1      'vars'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3      > RETURN                                                   ~2
   38     4*     > RETURN                                                   null

End of function __isset

End of class section.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.81 ms | 1404 KiB | 19 Q