3v4l.org

run code in 300+ 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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rSfeG
function name:  __isset
number of ops:  8
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        INIT_NS_FCALL_BY_NAME                                    'App%5Cproperty_exists'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6      > RETURN                                                   $2
    9     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/rSfeG
function name:  __get
number of ops:  10
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        INIT_NS_FCALL_BY_NAME                                    'App%5Cproperty_exists'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6      > JMPZ                                                     $2, ->9
   14     7    >   FETCH_OBJ_R                                      ~3      !0
          8      > RETURN                                                   ~3
   16     9    > > 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.0.0


preferences:
184.77 ms | 1396 KiB | 17 Q