3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public int $bar; public function __get($name) { echo "__get\n"; return 43; } public function __set($name, $value) { echo "__set\n"; } } $foo = new Foo(); echo "Read before assignment:\n"; try { echo $foo->bar, "\n"; } catch (Throwable $e) { echo $e->getMessage(), "\n"; } echo "Assignment before unset:\n"; $foo->bar = 42; unset($foo->bar); echo "Assignment after unset:\n"; $foo->bar = 42; echo "Read after unset:\n"; echo $foo->bar, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WpBp4
function name:  (null)
number of ops:  25
compiled vars:  !0 = $foo, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   NEW                                                  $2      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   17     3        ECHO                                                         'Read+before+assignment%3A%0A'
   19     4        FETCH_OBJ_R                                          ~5      !0, 'bar'
          5        ECHO                                                         ~5
          6        ECHO                                                         '%0A'
          7      > JMP                                                          ->13
   20     8  E > > CATCH                                           last         'Throwable'
   21     9    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         10        DO_FCALL                                          0  $6      
         11        ECHO                                                         $6
         12        ECHO                                                         '%0A'
   23    13    >   ECHO                                                         'Assignment+before+unset%3A%0A'
   24    14        ASSIGN_OBJ                                                   !0, 'bar'
         15        OP_DATA                                                      42
   25    16        UNSET_OBJ                                                    !0, 'bar'
   26    17        ECHO                                                         'Assignment+after+unset%3A%0A'
   27    18        ASSIGN_OBJ                                                   !0, 'bar'
         19        OP_DATA                                                      42
   28    20        ECHO                                                         'Read+after+unset%3A%0A'
   29    21        FETCH_OBJ_R                                          ~9      !0, 'bar'
         22        ECHO                                                         ~9
         23        ECHO                                                         '%0A'
         24      > RETURN                                                       1

Class Foo:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WpBp4
function name:  __get
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        ECHO                                                         '__get%0A'
    8     2      > RETURN                                                       43
    9     3*     > RETURN                                                       null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WpBp4
function name:  __set
number of ops:  4
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   12     2        ECHO                                                         '__set%0A'
   13     3      > RETURN                                                       null

End of function __set

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.98 ms | 1749 KiB | 12 Q