3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace App { 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/rSfeG
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   DECLARE_CLASS                                                'app%5Cfoo'
   25     1        NEW                                                  $1      'App%5CFoo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   26     4        FETCH_OBJ_R                                          ~4      !0, 'a'
          5        FREE                                                         ~4
   28     6        INIT_NS_FCALL_BY_NAME                                        'App%5Cvar_dump'
          7        ISSET_ISEMPTY_PROP_OBJ                               ~5      !0, 'a'
          8        SEND_VAL_EX                                                  ~5
          9        DO_FCALL                                          0          
   29    10      > RETURN                                                       1

Class App\AccessibleProperties:
Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 208) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rSfeG
function name:  __isset
number of ops:  12
compiled vars:  !0 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    8     1      > JMP_FRAMELESS                                   s8           'app%5Cproperty_exists', ->8
          2    >   INIT_NS_FCALL_BY_NAME                                        'App%5Cproperty_exists'
          3        FETCH_THIS                                           $1      
          4        SEND_VAR_EX                                                  $1
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0  $2      
          7      > JMP                                                          ->10
          8    >   FETCH_THIS                                           ~3      
          9        FRAMELESS_ICALL_2                property_exists      $2      ~3, !0
         10    > > RETURN                                                       $2
    9    11*     > RETURN                                                       null

End of function __isset

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 208) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Branch analysis from position: 13
filename:       /in/rSfeG
function name:  __get
number of ops:  14
compiled vars:  !0 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   13     1      > JMP_FRAMELESS                                   s8           'app%5Cproperty_exists', ->8
          2    >   INIT_NS_FCALL_BY_NAME                                        'App%5Cproperty_exists'
          3        FETCH_THIS                                           $1      
          4        SEND_VAR_EX                                                  $1
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0  $2      
          7      > JMP                                                          ->10
          8    >   FETCH_THIS                                           ~3      
          9        FRAMELESS_ICALL_2                property_exists      $2      ~3, !0
         10    > > JMPZ                                                         $2, ->13
   14    11    >   FETCH_OBJ_R                                          ~4      !0
         12      > RETURN                                                       ~4
   16    13    > > RETURN                                                       null

End of function __get

End of class App\AccessibleProperties.

Class App\Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
219.92 ms | 3196 KiB | 15 Q