3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = ['foo', 'bar', 'doo', 'lorem', 'ipsum']; // Take the current array-key from the URL $key = 3; // $_GET['key'] // validate if it really exists in the array, otherwise take a fallback if(!array_key_exists($key, $items)) $key = 0; // show data to this key echo $items[$key]; // provide a button to switch to the next array key sprintf('<a href="?key=%s">next</a>', $key+1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/c8N2Y
function name:  (null)
number of ops:  14
compiled vars:  !0 = $items, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 3
    9     2        ARRAY_KEY_EXISTS                                 ~4      !1, !0
          3        BOOL_NOT                                         ~5      ~4
          4      > JMPZ                                                     ~5, ->6
          5    >   ASSIGN                                                   !1, 0
   12     6    >   FETCH_DIM_R                                      ~7      !0, !1
          7        ECHO                                                     ~7
   15     8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 '%3Ca+href%3D%22%3Fkey%3D%25s%22%3Enext%3C%2Fa%3E'
         10        ADD                                              ~8      !1, 1
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.39 ms | 998 KiB | 14 Q