3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( 0 => 'fruit', 1 => 'apple', 2 => 'vegetable', 3 => 'corn', ); /* remove last item from odd arrays */ if( count( $input ) % 2 != 0 ) { array_pop( $input ); } $output = array(); $inputLength = count( $input ); for( $i = 0; $i < $inputLength; $i = $i + 2 ) { $output[$input[$i]] = $input[$i + 1]; } var_dump( $output );
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 = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 13
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 13
Branch analysis from position: 22
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/79L0W
function name:  (null)
number of ops:  26
compiled vars:  !0 = $input, !1 = $output, !2 = $inputLength, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        COUNT                                            ~5      !0
          2        MOD                                              ~6      ~5, 2
          3        IS_NOT_EQUAL                                             ~6, 0
          4      > JMPZ                                                     ~7, ->8
   12     5    >   INIT_FCALL                                               'array_pop'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                                 
   15     8    >   ASSIGN                                                   !1, <array>
   16     9        COUNT                                            ~10     !0
         10        ASSIGN                                                   !2, ~10
   18    11        ASSIGN                                                   !3, 0
         12      > JMP                                                      ->20
   20    13    >   FETCH_DIM_R                                      ~13     !0, !3
         14        ADD                                              ~15     !3, 1
         15        FETCH_DIM_R                                      ~16     !0, ~15
         16        ASSIGN_DIM                                               !1, ~13
         17        OP_DATA                                                  ~16
   18    18        ADD                                              ~17     !3, 2
         19        ASSIGN                                                   !3, ~17
         20    >   IS_SMALLER                                               !3, !2
         21      > JMPNZ                                                    ~19, ->13
   23    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.37 ms | 1395 KiB | 17 Q