3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { private array $data = []; public function __set(string $name, $value): void { $this->data[$name] = $value; } public function __isset(string $name): bool { return isset($this->data[$name]); } public function __unset(string $name): void { unset($this->data[$name]); } } $foo = new Foo(); $one = 1; $two = 2; $foo->$one = 'one'; $foo->$two = 'two'; var_dump( isset($foo->$one), // true isset($foo->$two) // true ); unset($foo->$one); var_dump( isset($foo->$one) // false );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HhPZP
function name:  (null)
number of ops:  21
compiled vars:  !0 = $foo, !1 = $one, !2 = $two
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   NEW                                                  $3      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   25     3        ASSIGN                                                       !1, 1
   26     4        ASSIGN                                                       !2, 2
   28     5        ASSIGN_OBJ                                                   !0, !1
          6        OP_DATA                                                      'one'
   29     7        ASSIGN_OBJ                                                   !0, !2
          8        OP_DATA                                                      'two'
   31     9        INIT_FCALL                                                   'var_dump'
   32    10        ISSET_ISEMPTY_PROP_OBJ                               ~10     !0, !1
         11        SEND_VAL                                                     ~10
   33    12        ISSET_ISEMPTY_PROP_OBJ                               ~11     !0, !2
         13        SEND_VAL                                                     ~11
   31    14        DO_ICALL                                                     
   36    15        UNSET_OBJ                                                    !0, !1
   38    16        INIT_FCALL                                                   'var_dump'
   39    17        ISSET_ISEMPTY_PROP_OBJ                               ~13     !0, !1
         18        SEND_VAL                                                     ~13
   38    19        DO_ICALL                                                     
   40    20      > RETURN                                                       1

Class Foo:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HhPZP
function name:  __set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    9     2        FETCH_OBJ_W                                          $2      'data'
          3        ASSIGN_DIM                                                   $2, !0
          4        OP_DATA                                                      !1
   10     5      > RETURN                                                       null

End of function __set

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HhPZP
function name:  __isset
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        FETCH_OBJ_IS                                         ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                             0  ~2      ~1, !0
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   15     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function __isset

Function __unset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HhPZP
function name:  __unset
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   19     1        FETCH_OBJ_UNSET                                      $1      'data'
          2        UNSET_DIM                                                    $1, !0
   20     3      > RETURN                                                       null

End of function __unset

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
143.25 ms | 2111 KiB | 14 Q