3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(); echo PHP_EOL . ' on empty array: ' . PHP_EOL; var_dump(key($array)); $array[] = 'f'; echo PHP_EOL . ' size one array: ' . PHP_EOL; var_dump(key($array)); echo PHP_EOL . ' within loop: ' . PHP_EOL; foreach ($array as $item) { var_dump(key($array)); } echo PHP_EOL . ' after loop: ' . PHP_EOL; var_dump(key($array)); reset($array); echo PHP_EOL . ' after reset: ' . PHP_EOL; var_dump(key($array)); end($array); echo PHP_EOL . ' after end: ' . PHP_EOL; var_dump(key($array));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/HZn84
function name:  (null)
number of ops:  56
compiled vars:  !0 = $array, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ECHO                                                     '%0A+on+empty+array%3A+%0A'
    4     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
    6     8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  'f'
    7    10        ECHO                                                     '%0A+size+one+array%3A+%0A'
    8    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'key'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                                 
   10    17        ECHO                                                     '%0A+within+loop%3A+%0A'
   11    18      > FE_RESET_R                                       $8      !0, ->27
         19    > > FE_FETCH_R                                               $8, !1, ->27
   12    20    >   INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'key'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
   11    26      > JMP                                                      ->19
         27    >   FE_FREE                                                  $8
   15    28        ECHO                                                     '%0A+after+loop%3A+%0A'
   16    29        INIT_FCALL                                               'var_dump'
         30        INIT_FCALL                                               'key'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $11     
         33        SEND_VAR                                                 $11
         34        DO_ICALL                                                 
   18    35        INIT_FCALL                                               'reset'
         36        SEND_REF                                                 !0
         37        DO_ICALL                                                 
   19    38        ECHO                                                     '%0A+after+reset%3A+%0A'
   20    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL                                               'key'
         41        SEND_VAR                                                 !0
         42        DO_ICALL                                         $14     
         43        SEND_VAR                                                 $14
         44        DO_ICALL                                                 
   22    45        INIT_FCALL                                               'end'
         46        SEND_REF                                                 !0
         47        DO_ICALL                                                 
   23    48        ECHO                                                     '%0A+after+end%3A+%0A'
   24    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'key'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                         $17     
         53        SEND_VAR                                                 $17
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.07 ms | 945 KiB | 22 Q