3v4l.org

run code in 300+ 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(); $foo->{1} = 'one'; $foo->{2} = 'two'; var_dump( isset($foo->{1}), // true isset($foo->{2}) // true ); unset($foo->{1}); var_dump( isset($foo->{1}) // false );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0k4LS
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        ASSIGN_OBJ                                               !0, '1'
          4        OP_DATA                                                  'one'
   26     5        ASSIGN_OBJ                                               !0, '2'
          6        OP_DATA                                                  'two'
   28     7        INIT_FCALL                                               'var_dump'
   29     8        ISSET_ISEMPTY_PROP_OBJ                           ~6      !0, '1'
          9        SEND_VAL                                                 ~6
   30    10        ISSET_ISEMPTY_PROP_OBJ                           ~7      !0, '2'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   33    13        UNSET_OBJ                                                !0, '1'
   35    14        INIT_FCALL                                               'var_dump'
   36    15        ISSET_ISEMPTY_PROP_OBJ                           ~9      !0, '1'
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   37    18      > RETURN                                                   1

Class Foo:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0k4LS
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/0k4LS
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/0k4LS
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.0.0


preferences:
174.84 ms | 1400 KiB | 15 Q