3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { var $a = 5; public $bg = ['g'=>44,'h'=>55]; public function __set($name, $value) { echo $this->bg[$name]; if(!(isset($this->bg[$name]))) { throw new Exception("Cannot add new property \$$name to instance of " . __CLASS__); } } } $a=new A; echo $a->a; $a->a = 9; echo $a->a; $a->g = 88; echo $a->g;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZN2sV
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        FETCH_OBJ_R                                      ~4      !0, 'a'
          4        ECHO                                                     ~4
   21     5        ASSIGN_OBJ                                               !0, 'a'
          6        OP_DATA                                                  9
   22     7        FETCH_OBJ_R                                      ~6      !0, 'a'
          8        ECHO                                                     ~6
   24     9        ASSIGN_OBJ                                               !0, 'g'
         10        OP_DATA                                                  88
   25    11        FETCH_OBJ_R                                      ~8      !0, 'g'
         12        ECHO                                                     ~8
         13      > RETURN                                                   1

Class A:
Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZN2sV
function name:  __set
number of ops:  18
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_OBJ_R                                      ~2      'bg'
          3        FETCH_DIM_R                                      ~3      ~2, !0
          4        ECHO                                                     ~3
   13     5        FETCH_OBJ_IS                                     ~4      'bg'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !0
          7        BOOL_NOT                                         ~6      ~5
          8      > JMPZ                                                     ~6, ->17
   14     9    >   NEW                                              $7      'Exception'
         10        ROPE_INIT                                     3  ~9      'Cannot+add+new+property+%24'
         11        ROPE_ADD                                      1  ~9      ~9, !0
         12        ROPE_END                                      2  ~8      ~9, '+to+instance+of+'
         13        CONCAT                                           ~11     ~8, 'A'
         14        SEND_VAL_EX                                              ~11
         15        DO_FCALL                                      0          
         16      > THROW                                         0          $7
   16    17    > > RETURN                                                   null

End of function __set

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.76 ms | 1395 KiB | 13 Q