3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private ?int $foo; private ?int $bar = 1; private ?int $baz = null; public function propertyInitialized($name): bool { if (property_exists($this, $name)) { try { return $this->$name === null || $this->$name !== null; } Catch(Error $e) { return false; } } else { return false; } } } $foo = new foo; var_dump($foo->propertyInitialized('foo'), $foo->propertyInitialized('bar'), $foo->propertyInitialized('baz'), $foo->propertyInitialized('doesNotExist'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XSJHV
function name:  (null)
number of ops:  22
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_METHOD_CALL                                         !0, 'propertyInitialized'
          5        SEND_VAL_EX                                              'foo'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        INIT_METHOD_CALL                                         !0, 'propertyInitialized'
          9        SEND_VAL_EX                                              'bar'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        INIT_METHOD_CALL                                         !0, 'propertyInitialized'
         13        SEND_VAL_EX                                              'baz'
         14        DO_FCALL                                      0  $6      
         15        SEND_VAR                                                 $6
         16        INIT_METHOD_CALL                                         !0, 'propertyInitialized'
         17        SEND_VAL_EX                                              'doesNotExist'
         18        DO_FCALL                                      0  $7      
         19        SEND_VAR                                                 $7
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class Foo:
Function propertyinitialized:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 47) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 16
Branch analysis from position: 16
2 jumps found. (Code = 107) Position 1 = 17, Position 2 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XSJHV
function name:  propertyInitialized
number of ops:  22
compiled vars:  !0 = $name, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'property_exists'
          2        FETCH_THIS                                       ~2      
          3        SEND_VAL                                                 ~2
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6      > JMPZ                                                     $3, ->19
   12     7    >   FETCH_OBJ_R                                      ~4      !0
          8        TYPE_CHECK                                    2  ~5      ~4
          9      > JMPNZ_EX                                         ~5      ~5, ->13
         10    >   FETCH_OBJ_R                                      ~6      !0
         11        TYPE_CHECK                                  1020  ~7      ~6
         12        BOOL                                             ~5      ~7
         13    >   VERIFY_RETURN_TYPE                                       ~5
         14      > RETURN                                                   ~5
         15*       JMP                                                      ->18
   13    16  E > > CATCH                                       last         'Error'
   14    17    > > RETURN                                                   <false>
         18*       JMP                                                      ->20
   17    19    > > RETURN                                                   <false>
   19    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of function propertyinitialized

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.19 ms | 1400 KiB | 17 Q