3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AccessibleProperties { public function __isset($property) { return property_exists($this, $property); } public function __get($property) { if (property_exists($this, $property)) { return $this->$property; } } } class Foo { use AccessibleProperties; protected $a = 'Some value'; } $foo = new Foo; $foo->a; // this works: returns 'Some value' var_dump(isset($foo->a)); // this doesn't work: returns false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9Lpv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  18     0  E >   ADD_INTERFACE                                            'foo'
  24     1        NEW                                              $1      :17
         2        DO_FCALL                                      0          
         3        QM_ASSIGN                                                !0
  25     4        FETCH_OBJ_R                                      ~4      !0, 'a'
         5        FREE                                                     ~4
  27     6        INIT_FCALL                                               'var_dump'
         7        ISSET_ISEMPTY_PROP_OBJ                           ~5      !0, 'a'
         8        SEND_VAL                                                 ~5
         9        DO_ICALL                                                 
        10      > RETURN                                                   1

Class AccessibleProperties:
Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9Lpv
function name:  __isset
number of ops:  8
compiled vars:  !0 = $property
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   RECV                                             !0      
   7     1        INIT_FCALL                                               'property_exists'
         2        FETCH_THIS                                       ~1      
         3        SEND_VAL                                                 ~1
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $2      
         6      > RETURN                                                   $2
   8     7*     > RETURN                                                   null

End of function __isset

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9Lpv
function name:  __get
number of ops:  10
compiled vars:  !0 = $property
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  10     0  E >   RECV                                             !0      
  12     1        INIT_FCALL                                               'property_exists'
         2        FETCH_THIS                                       ~1      
         3        SEND_VAL                                                 ~1
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $2      
         6      > JMPZ                                                     $2, ->9
  13     7    >   FETCH_OBJ_R                                      ~3      !0
         8      > RETURN                                                   ~3
  15     9    > > RETURN                                                   null

End of function __get

End of class AccessibleProperties.

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
56.57 ms | 462 KiB | 7 Q