3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private $foo = 42; public function __get($name) { echo "__get($name)\n"; return $this->bar($name); } public function bar($name) { echo "bar($name)\n"; return $this->foo; } } $foo = new Foo; echo "Calling via accessor:\n"; var_dump($foo->foo); echo "Calling method directly:\n"; var_dump($foo->bar('foo'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5Yos
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   19     3        ECHO                                                         'Calling+via+accessor%3A%0A'
   20     4        INIT_FCALL                                                   'var_dump'
          5        FETCH_OBJ_R                                          ~4      !0, 'foo'
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                                     
   22     8        ECHO                                                         'Calling+method+directly%3A%0A'
   23     9        INIT_FCALL                                                   'var_dump'
         10        INIT_METHOD_CALL                                             !0, 'bar'
         11        SEND_VAL_EX                                                  'foo'
         12        DO_FCALL                                          0  $6      
         13        SEND_VAR                                                     $6
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Class Foo:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5Yos
function name:  __get
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        ROPE_INIT                                         3  ~2      '__get%28'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%29%0A'
          4        ECHO                                                         ~1
    8     5        INIT_METHOD_CALL                                             'bar'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0  $4      
          8      > RETURN                                                       $4
    9     9*     > RETURN                                                       null

End of function __get

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5Yos
function name:  bar
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        ROPE_INIT                                         3  ~2      'bar%28'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%29%0A'
          4        ECHO                                                         ~1
   13     5        FETCH_OBJ_R                                          ~4      'foo'
          6      > RETURN                                                       ~4
   14     7*     > RETURN                                                       null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.92 ms | 1600 KiB | 14 Q