3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private mixed $data; public function getData(): mixed { return $this->data; } public function setData(mixed $data): void { $this->data = $data; } } function my_isset(object $object, string $property): bool { $r = new ReflectionProperty($object::class, $property); return $r->isInitialized($object) && $r->getValue($object) !== null; } $foo = new Foo(); var_dump(my_isset($foo, 'data')); $foo->setData(42); var_dump(my_isset($foo, 'data')); // This does not actually work because the property is not accessible var_dump(isset($foo->data));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vgefL
function name:  (null)
number of ops:  25
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   23     3        INIT_FCALL                                                   'var_dump'
          4        INIT_FCALL                                                   'my_isset'
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     'data'
          7        DO_FCALL                                          0  $4      
          8        SEND_VAR                                                     $4
          9        DO_ICALL                                                     
   24    10        INIT_METHOD_CALL                                             !0, 'setData'
         11        SEND_VAL_EX                                                  42
         12        DO_FCALL                                          0          
   25    13        INIT_FCALL                                                   'var_dump'
         14        INIT_FCALL                                                   'my_isset'
         15        SEND_VAR                                                     !0
         16        SEND_VAL                                                     'data'
         17        DO_FCALL                                          0  $7      
         18        SEND_VAR                                                     $7
         19        DO_ICALL                                                     
   27    20        INIT_FCALL                                                   'var_dump'
         21        ISSET_ISEMPTY_PROP_OBJ                               ~9      !0, 'data'
         22        SEND_VAL                                                     ~9
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Function my_isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/vgefL
function name:  my_isset
number of ops:  21
compiled vars:  !0 = $object, !1 = $property, !2 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   18     2        NEW                                                  $3      'ReflectionProperty'
          3        FETCH_CLASS_NAME                                     ~4      !0
          4        SEND_VAL_EX                                                  ~4
          5        SEND_VAR_EX                                                  !1
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !2, $3
   19     8        INIT_METHOD_CALL                                             !2, 'isInitialized'
          9        SEND_VAR_EX                                                  !0
         10        DO_FCALL                                          0  $7      
         11      > JMPZ_EX                                              ~8      $7, ->17
         12    >   INIT_METHOD_CALL                                             !2, 'getValue'
         13        SEND_VAR_EX                                                  !0
         14        DO_FCALL                                          0  $9      
         15        TYPE_CHECK                                      1020  ~10     $9
         16        BOOL                                                 ~8      ~10
         17    >   VERIFY_RETURN_TYPE                                           ~8
         18      > RETURN                                                       ~8
   20    19*       VERIFY_RETURN_TYPE                                           
         20*     > RETURN                                                       null

End of function my_isset

Class Foo:
Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vgefL
function name:  getData
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                          ~0      'data'
          1      > RETURN                                                       ~0
    9     2*       VERIFY_RETURN_TYPE                                           
          3*     > RETURN                                                       null

End of function getdata

Function setdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vgefL
function name:  setData
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        ASSIGN_OBJ                                                   'data'
          2        OP_DATA                                                      !0
   13     3      > RETURN                                                       null

End of function setdata

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.89 ms | 486 KiB | 10 Q