3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Initialize the array with a fixed length $array = new SplFixedArray(5); $array[1] = 2; $array[4] = "foo"; var_dump($array[0]); // NULL var_dump($array[1]); // int(2) var_dump($array["4"]); // string(3) "foo" // Increase the size of the array to 10 $array->setSize(10); $array[9] = "asdf"; // Shrink the array to a size of 2 $array->setSize(2); // The following lines throw a RuntimeException: Index invalid or out of range try { var_dump($array["non-numeric"]); } catch(RuntimeException $re) { echo "RuntimeException: ".$re->getMessage()."\n"; } try { var_dump($array[-1]); } catch(RuntimeException $re) { echo "RuntimeException: ".$re->getMessage()."\n"; } try { var_dump($array[5]); } catch(RuntimeException $re) { echo "RuntimeException: ".$re->getMessage()."\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 33
Branch analysis from position: 33
2 jumps found. (Code = 107) Position 1 = 34, Position 2 = -2
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Found catch point at position: 44
Branch analysis from position: 44
2 jumps found. (Code = 107) Position 1 = 45, Position 2 = -2
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Found catch point at position: 55
Branch analysis from position: 55
2 jumps found. (Code = 107) Position 1 = 56, Position 2 = -2
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sdIQd
function name:  (null)
number of ops:  62
compiled vars:  !0 = $array, !1 = $re
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   NEW                                                  $2      'SplFixedArray'
          1        SEND_VAL_EX                                                  5
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
    6     4        ASSIGN_DIM                                                   !0, 1
          5        OP_DATA                                                      2
    7     6        ASSIGN_DIM                                                   !0, 4
          7        OP_DATA                                                      'foo'
    9     8        INIT_FCALL                                                   'var_dump'
          9        FETCH_DIM_R                                          ~7      !0, 0
         10        SEND_VAL                                                     ~7
         11        DO_ICALL                                                     
   10    12        INIT_FCALL                                                   'var_dump'
         13        FETCH_DIM_R                                          ~9      !0, 1
         14        SEND_VAL                                                     ~9
         15        DO_ICALL                                                     
   12    16        INIT_FCALL                                                   'var_dump'
         17        FETCH_DIM_R                                          ~11     !0, 4
         18        SEND_VAL                                                     ~11
         19        DO_ICALL                                                     
   15    20        INIT_METHOD_CALL                                             !0, 'setSize'
         21        SEND_VAL_EX                                                  10
         22        DO_FCALL                                          0          
   17    23        ASSIGN_DIM                                                   !0, 9
         24        OP_DATA                                                      'asdf'
   20    25        INIT_METHOD_CALL                                             !0, 'setSize'
         26        SEND_VAL_EX                                                  2
         27        DO_FCALL                                          0          
   24    28        INIT_FCALL                                                   'var_dump'
         29        FETCH_DIM_R                                          ~16     !0, 'non-numeric'
         30        SEND_VAL                                                     ~16
         31        DO_ICALL                                                     
         32      > JMP                                                          ->39
   25    33  E > > CATCH                                           last         'RuntimeException'
   26    34    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         35        DO_FCALL                                          0  $18     
         36        CONCAT                                               ~19     'RuntimeException%3A+', $18
         37        CONCAT                                               ~20     ~19, '%0A'
         38        ECHO                                                         ~20
   30    39    >   INIT_FCALL                                                   'var_dump'
         40        FETCH_DIM_R                                          ~21     !0, -1
         41        SEND_VAL                                                     ~21
         42        DO_ICALL                                                     
         43      > JMP                                                          ->50
   31    44  E > > CATCH                                           last         'RuntimeException'
   32    45    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         46        DO_FCALL                                          0  $23     
         47        CONCAT                                               ~24     'RuntimeException%3A+', $23
         48        CONCAT                                               ~25     ~24, '%0A'
         49        ECHO                                                         ~25
   36    50    >   INIT_FCALL                                                   'var_dump'
         51        FETCH_DIM_R                                          ~26     !0, 5
         52        SEND_VAL                                                     ~26
         53        DO_ICALL                                                     
         54      > JMP                                                          ->61
   37    55  E > > CATCH                                           last         'RuntimeException'
   38    56    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         57        DO_FCALL                                          0  $28     
         58        CONCAT                                               ~29     'RuntimeException%3A+', $28
         59        CONCAT                                               ~30     ~29, '%0A'
         60        ECHO                                                         ~30
   39    61    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.22 ms | 482 KiB | 8 Q