3v4l.org

run code in 500+ PHP versions simultaneously
<?php class TestKey { private $data = array(); public function __set($name, $value) { $this->data[$name] = $value; } public function __get($name) { return @$this->data[$name]; } /** As of PHP 5.1.0 */ public function __isset($name) { if (array_key_exists($name, $this->data)) { return true; } return false; } /** As of PHP 5.1.0 */ public function __unset($name) { unset($this->data[$name]); } } class TestValue { private $data = array(); public function __set($name, $value) { $this->data[$name] = $value; } public function __get($name) { return @$this->data[$name]; } /** As of PHP 5.1.0 */ public function __isset($name) { return isset($this->data[$name]); } /** As of PHP 5.1.0 */ public function __unset($name) { $this->data[$name] = null; } } $k = new TestKey(); $v = new TestValue(); $k->foo = $v->foo = "bar"; var_dump(isset($k->foo) === isset($v->foo)); $k->foo = $v->foo = null; var_dump(isset($k->foo) === isset($v->foo)); unset($k->foo, $v->foo); var_dump(isset($k->foo) === isset($v->foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TQGdK
function name:  (null)
number of ops:  35
compiled vars:  !0 = $k, !1 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   50     0  E >   NEW                                                  $2      'TestKey'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   51     3        NEW                                                  $5      'TestValue'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   53     6        ASSIGN_OBJ                                           ~9      !1, 'foo'
          7        OP_DATA                                                      'bar'
          8        ASSIGN_OBJ                                                   !0, 'foo'
          9        OP_DATA                                                      ~9
   54    10        INIT_FCALL                                                   'var_dump'
         11        ISSET_ISEMPTY_PROP_OBJ                               ~10     !0, 'foo'
         12        ISSET_ISEMPTY_PROP_OBJ                               ~11     !1, 'foo'
         13        IS_IDENTICAL                                         ~12     ~10, ~11
         14        SEND_VAL                                                     ~12
         15        DO_ICALL                                                     
   55    16        ASSIGN_OBJ                                           ~15     !1, 'foo'
         17        OP_DATA                                                      null
         18        ASSIGN_OBJ                                                   !0, 'foo'
         19        OP_DATA                                                      ~15
   56    20        INIT_FCALL                                                   'var_dump'
         21        ISSET_ISEMPTY_PROP_OBJ                               ~16     !0, 'foo'
         22        ISSET_ISEMPTY_PROP_OBJ                               ~17     !1, 'foo'
         23        IS_IDENTICAL                                         ~18     ~16, ~17
         24        SEND_VAL                                                     ~18
         25        DO_ICALL                                                     
   57    26        UNSET_OBJ                                                    !0, 'foo'
         27        UNSET_OBJ                                                    !1, 'foo'
   58    28        INIT_FCALL                                                   'var_dump'
         29        ISSET_ISEMPTY_PROP_OBJ                               ~20     !0, 'foo'
         30        ISSET_ISEMPTY_PROP_OBJ                               ~21     !1, 'foo'
         31        IS_IDENTICAL                                         ~22     ~20, ~21
         32        SEND_VAL                                                     ~22
         33        DO_ICALL                                                     
         34      > RETURN                                                       1

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

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TQGdK
function name:  __get
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        BEGIN_SILENCE                                        ~1      
          2        FETCH_OBJ_R                                          ~2      'data'
          3        FETCH_DIM_R                                          ~3      ~2, !0
          4        END_SILENCE                                                  ~1
          5      > RETURN                                                       ~3
   11     6*     > RETURN                                                       null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TQGdK
function name:  __isset
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   15     1        FETCH_OBJ_R                                          ~1      'data'
          2        ARRAY_KEY_EXISTS                                             !0, ~1
          3      > JMPZ                                                         ~2, ->5
   16     4    > > RETURN                                                       <true>
   19     5    > > RETURN                                                       <false>
   20     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/TQGdK
function name:  __unset
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   RECV                                                 !0      
   24     1        FETCH_OBJ_UNSET                                      $1      'data'
          2        UNSET_DIM                                                    $1, !0
   25     3      > RETURN                                                       null

End of function __unset

End of class TestKey.

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

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TQGdK
function name:  __get
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
   36     1        BEGIN_SILENCE                                        ~1      
          2        FETCH_OBJ_R                                          ~2      'data'
          3        FETCH_DIM_R                                          ~3      ~2, !0
          4        END_SILENCE                                                  ~1
          5      > RETURN                                                       ~3
   37     6*     > RETURN                                                       null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TQGdK
function name:  __isset
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   40     0  E >   RECV                                                 !0      
   41     1        FETCH_OBJ_IS                                         ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                             0  ~2      ~1, !0
          3      > RETURN                                                       ~2
   42     4*     > 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/TQGdK
function name:  __unset
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   45     0  E >   RECV                                                 !0      
   46     1        FETCH_OBJ_W                                          $1      'data'
          2        ASSIGN_DIM                                                   $1, !0
          3        OP_DATA                                                      null
   47     4      > RETURN                                                       null

End of function __unset

End of class TestValue.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.64 ms | 3283 KiB | 14 Q