3v4l.org

run code in 500+ 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 >   DECLARE_CLASS                                                'foo'
   24     1        NEW                                                  $1      'Foo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   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:  5
compiled vars:  !0 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    7     1        FETCH_THIS                                           ~1      
          2        FRAMELESS_ICALL_2                property_exists      ~2      ~1, !0
          3      > RETURN                                                       ~2
    8     4*     > RETURN                                                       null

End of function __isset

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

End of function __get

End of class AccessibleProperties.

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.47 ms | 1981 KiB | 14 Q