3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Dictionary implements ArrayAccess { function offsetExists($offset) {} function offsetGet($offset) {} function offsetUnset($offset) {} function offsetSet($offset, $value) { if (!is_string($offset)) { throw new InvalidArgumentException(); } } } try { $Dictionary = new Dictionary(); $Dictionary["12"] = 0xDEADBEEF; echo "No Exception for \"12\"\n"; } catch (InvalidArgumentException $e) { echo "Caught Exception for \"12\"\n"; } try { $str = "12"; $Dictionary[$str] = 0xDEADBEEF; echo "No Exception for \$variable = \"12\"\n"; } catch (InvalidArgumentException $e) { echo "Caught Exception for \$variable = \"12\"\n"; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Found catch point at position: 15
Branch analysis from position: 15
2 jumps found. (Code = 107) Position 1 = 16, Position 2 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XGtVh
function name:  (null)
number of ops:  18
compiled vars:  !0 = $Dictionary, !1 = $e, !2 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'dictionary'
   15     1        NEW                                              $3      'Dictionary'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   16     4        ASSIGN_DIM                                               !0, 12
          5        OP_DATA                                                  3735928559
   17     6        ECHO                                                     'No+Exception+for+%2212%22%0A'
          7      > JMP                                                      ->10
   18     8  E > > CATCH                                       last         'InvalidArgumentException'
   19     9    >   ECHO                                                     'Caught+Exception+for+%2212%22%0A'
   23    10    >   ASSIGN                                                   !2, '12'
   24    11        ASSIGN_DIM                                               !0, !2
         12        OP_DATA                                                  3735928559
   25    13        ECHO                                                     'No+Exception+for+%24variable+%3D+%2212%22%0A'
         14      > JMP                                                      ->17
   26    15  E > > CATCH                                       last         'InvalidArgumentException'
   27    16    >   ECHO                                                     'Caught+Exception+for+%24variable+%3D+%2212%22%0A'
   30    17    > > RETURN                                                   1

Class Dictionary:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XGtVh
function name:  offsetExists
number of ops:  2
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XGtVh
function name:  offsetGet
number of ops:  2
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function offsetget

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XGtVh
function name:  offsetUnset
number of ops:  2
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function offsetunset

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XGtVh
function name:  offsetSet
number of ops:  9
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        TYPE_CHECK                                   64  ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->8
    9     5    >   NEW                                              $4      'InvalidArgumentException'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
   11     8    > > RETURN                                                   null

End of function offsetset

End of class Dictionary.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.18 ms | 1399 KiB | 13 Q