3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private $foo = ["a" => [1, 2, 3]]; function __get($a) { if (isset($this->foo[$a])) { return $this->foo[$a]; } throw new Exception("Invalid key accessed! Check with isset() first!"); } function __isset($a) { return isset($this->foo[$a]); } } $obj = new A; var_dump(isset($obj->a[1])); var_dump(isset($obj->b[1]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r8U7T
function name:  (null)
number of ops:  14
compiled vars:  !0 = $obj
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $1      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   19     3        INIT_FCALL                                                   'var_dump'
          4        FETCH_OBJ_IS                                         ~4      !0, 'a'
          5        ISSET_ISEMPTY_DIM_OBJ                             0  ~5      ~4, 1
          6        SEND_VAL                                                     ~5
          7        DO_ICALL                                                     
   20     8        INIT_FCALL                                                   'var_dump'
          9        FETCH_OBJ_IS                                         ~7      !0, 'b'
         10        ISSET_ISEMPTY_DIM_OBJ                             0  ~8      ~7, 1
         11        SEND_VAL                                                     ~8
         12        DO_ICALL                                                     
         13      > RETURN                                                       1

Class A:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/r8U7T
function name:  __get
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        FETCH_OBJ_IS                                         ~1      'foo'
          2        ISSET_ISEMPTY_DIM_OBJ                             0          ~1, !0
          3      > JMPZ                                                         ~2, ->7
    8     4    >   FETCH_OBJ_R                                          ~3      'foo'
          5        FETCH_DIM_R                                          ~4      ~3, !0
          6      > RETURN                                                       ~4
   10     7    >   NEW                                                  $5      'Exception'
          8        SEND_VAL_EX                                                  'Invalid+key+accessed%21+Check+with+isset%28%29+first%21'
          9        DO_FCALL                                          0          
         10      > THROW                                             0          $5
   11    11*     > RETURN                                                       null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r8U7T
function name:  __isset
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   14     1        FETCH_OBJ_IS                                         ~1      'foo'
          2        ISSET_ISEMPTY_DIM_OBJ                             0  ~2      ~1, !0
          3      > RETURN                                                       ~2
   15     4*     > RETURN                                                       null

End of function __isset

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
201.05 ms | 2243 KiB | 14 Q