3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements Stringable { public function __toString(): string { return 'FOO'; } public function __get(mixed $key): mixed { var_dump(compact('key')); return 1; } } $foo = new Foo(); $foo->foo; $foo->$foo; $foo->{1}; $foo->{false}; $foo->{null};
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0noRl
function name:  (null)
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   18     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   19     4        FETCH_OBJ_R                                      ~4      !0, 'foo'
          5        FREE                                                     ~4
   20     6        FETCH_OBJ_R                                      ~5      !0, !0
          7        FREE                                                     ~5
   21     8        FETCH_OBJ_R                                      ~6      !0, '1'
          9        FREE                                                     ~6
   22    10        FETCH_OBJ_R                                      ~7      !0, ''
         11        FREE                                                     ~7
   23    12        FETCH_OBJ_R                                      ~8      !0, ''
         13        FREE                                                     ~8
         14      > RETURN                                                   1

Class Foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0noRl
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   'FOO'
    8     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0noRl
function name:  __get
number of ops:  10
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'compact'
          3        SEND_VAL                                                 'key'
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                                 
   14     7      > RETURN                                                   1
   15     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function __get

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.6 ms | 1002 KiB | 15 Q