3v4l.org

run code in 300+ PHP versions simultaneously
<?php $types = array( "text" => 2, "image" => 2, "audio" => 2, ); $result = []; while ($types) { $key = key($types); $result[] = $key; if ($types[$key] === 1) { unset($types[$key]); } else { --$types[$key]; } if (!next($types)) { reset($types); } } var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 3
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 3
Branch analysis from position: 25
Branch analysis from position: 3
Branch analysis from position: 24
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
Branch analysis from position: 24
filename:       /in/GRABq
function name:  (null)
number of ops:  29
compiled vars:  !0 = $types, !1 = $result, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > JMP                                                      ->24
   11     3    >   INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   12     7        ASSIGN_DIM                                               !1
          8        OP_DATA                                                  !2
   13     9        FETCH_DIM_R                                      ~8      !0, !2
         10        IS_IDENTICAL                                             ~8, 1
         11      > JMPZ                                                     ~9, ->14
   14    12    >   UNSET_DIM                                                !0, !2
   13    13      > JMP                                                      ->16
   16    14    >   FETCH_DIM_RW                                     $10     !0, !2
         15        PRE_DEC                                                  $10
   18    16    >   INIT_FCALL                                               'next'
         17        SEND_REF                                                 !0
         18        DO_ICALL                                         $12     
         19        BOOL_NOT                                         ~13     $12
         20      > JMPZ                                                     ~13, ->24
   19    21    >   INIT_FCALL                                               'reset'
         22        SEND_REF                                                 !0
         23        DO_ICALL                                                 
   10    24    > > JMPNZ                                                    !0, ->3
   22    25    >   INIT_FCALL                                               'var_export'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.67 ms | 1002 KiB | 17 Q