3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1,Home,3,Services,6,Service 1,7,Service 2,2,Products'; $keysAndValues = explode(',', $input); $result = []; $count = count($keysAndValues); for ($i = 0; $i < $count; $i+=2) { $key = $keysAndValues[$i]; $value = $keysAndValues[$i+1]; $result[$key] = $value; } var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
Branch analysis from position: 11
filename:       /in/SRiVv
function name:  (null)
number of ops:  25
compiled vars:  !0 = $input, !1 = $keysAndValues, !2 = $result, !3 = $count, !4 = $i, !5 = $key, !6 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1%2CHome%2C3%2CServices%2C6%2CService+1%2C7%2CService+2%2C2%2CProducts'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    7     6        ASSIGN                                                   !2, <array>
    8     7        COUNT                                            ~11     !1
          8        ASSIGN                                                   !3, ~11
    9     9        ASSIGN                                                   !4, 0
         10      > JMP                                                      ->19
   10    11    >   FETCH_DIM_R                                      ~14     !1, !4
         12        ASSIGN                                                   !5, ~14
   11    13        ADD                                              ~16     !4, 1
         14        FETCH_DIM_R                                      ~17     !1, ~16
         15        ASSIGN                                                   !6, ~17
   13    16        ASSIGN_DIM                                               !2, !5
         17        OP_DATA                                                  !6
    9    18        ASSIGN_OP                                     1          !4, 2
         19    >   IS_SMALLER                                               !4, !3
         20      > JMPNZ                                                    ~21, ->11
   16    21    >   INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.2 ms | 953 KiB | 15 Q