3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = "Name,Age,Location Jo,28,London Do,35,London"; $arr= explode("\n", $str); $keys = explode(",",array_shift($arr)); Foreach($arr as $line){ $new[]= array_combine($keys, explode(",", $line)); } Var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 27
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/hAmCN
function name:  (null)
number of ops:  32
compiled vars:  !0 = $str, !1 = $arr, !2 = $keys, !3 = $line, !4 = $new
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'Name%2CAge%2CLocation%0AJo%2C28%2CLondon%0ADo%2C35%2CLondon'
    7     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '%0A'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $6      
          5        ASSIGN                                                       !1, $6
    8     6        INIT_FCALL                                                   'explode'
          7        SEND_VAL                                                     '%2C'
          8        INIT_FCALL                                                   'array_shift'
          9        SEND_REF                                                     !1
         10        DO_ICALL                                             $8      
         11        SEND_VAR                                                     $8
         12        DO_ICALL                                             $9      
         13        ASSIGN                                                       !2, $9
    9    14      > FE_RESET_R                                           $11     !1, ->27
         15    > > FE_FETCH_R                                                   $11, !3, ->27
   10    16    >   INIT_FCALL                                                   'array_combine'
         17        SEND_VAR                                                     !2
         18        INIT_FCALL                                                   'explode'
         19        SEND_VAL                                                     '%2C'
         20        SEND_VAR                                                     !3
         21        DO_ICALL                                             $13     
         22        SEND_VAR                                                     $13
         23        DO_ICALL                                             $14     
         24        ASSIGN_DIM                                                   !4
         25        OP_DATA                                                      $14
    9    26      > JMP                                                          ->15
         27    >   FE_FREE                                                      $11
   13    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !4
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.87 ms | 2711 KiB | 17 Q