3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'key1\value1\key2\value2\key3\value3\key4\value4\key5\value5'; $result = []; foreach (array_chunk(explode('\\', $str), 2) as [$key, $val]) { $result[$key] = $val; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/tIhYv
function name:  (null)
number of ops:  25
compiled vars:  !0 = $str, !1 = $result, !2 = $key, !3 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'key1%5Cvalue1%5Ckey2%5Cvalue2%5Ckey3%5Cvalue3%5Ckey4%5Cvalue4%5Ckey5%5Cvalue5'
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_chunk'
          3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%5C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        SEND_VAL                                                 2
          9        DO_ICALL                                         $7      
         10      > FE_RESET_R                                       $8      $7, ->20
         11    > > FE_FETCH_R                                               $8, $9, ->20
         12    >   FETCH_LIST_R                                     $10     $9, 0
         13        ASSIGN                                                   !2, $10
         14        FETCH_LIST_R                                     $12     $9, 1
         15        ASSIGN                                                   !3, $12
         16        FREE                                                     $9
    7    17        ASSIGN_DIM                                               !1, !2
         18        OP_DATA                                                  !3
    6    19      > JMP                                                      ->11
         20    >   FE_FREE                                                  $8
    9    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.09 ms | 1395 KiB | 19 Q