3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = array( "action: Added; amount: 1; code: RNA1; name: Mens Organic T-shirt; colour: White; size: XL", "action: Subtracted; amount: 7; code: RNC1; name: Kids Basic T-shirt; colour: Denim Blue; size: 3-4y", "action: Added; amount: 20; code: RNV1; name: Gift Voucher; style: Mens; value: £20", ); $data = []; foreach ($arr as $line) { $newItem = []; foreach (explode(';', $line) as $item) { $parts = explode(':', $item); $newItem[trim($parts[0])] = trim($parts[1]); } $data[] = $newItem; } print_r($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 27
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/iEZgo
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $data, !2 = $line, !3 = $newItem, !4 = $item, !5 = $parts
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   12     1        ASSIGN                                                       !1, <array>
   13     2      > FE_RESET_R                                           $8      !0, ->27
          3    > > FE_FETCH_R                                                   $8, !2, ->27
   14     4    >   ASSIGN                                                       !3, <array>
   15     5        INIT_FCALL                                                   'explode'
          6        SEND_VAL                                                     '%3B'
          7        SEND_VAR                                                     !2
          8        DO_ICALL                                             $10     
          9      > FE_RESET_R                                           $11     $10, ->23
         10    > > FE_FETCH_R                                                   $11, !4, ->23
   16    11    >   INIT_FCALL                                                   'explode'
         12        SEND_VAL                                                     '%3A'
         13        SEND_VAR                                                     !4
         14        DO_ICALL                                             $12     
         15        ASSIGN                                                       !5, $12
   17    16        FETCH_DIM_R                                          ~14     !5, 0
         17        FRAMELESS_ICALL_1                trim                ~15     ~14
         18        FETCH_DIM_R                                          ~17     !5, 1
         19        FRAMELESS_ICALL_1                trim                ~18     ~17
         20        ASSIGN_DIM                                                   !3, ~15
         21        OP_DATA                                                      ~18
   15    22      > JMP                                                          ->10
         23    >   FE_FREE                                                      $11
   19    24        ASSIGN_DIM                                                   !1
         25        OP_DATA                                                      !3
   13    26      > JMP                                                          ->3
         27    >   FE_FREE                                                      $8
   22    28        INIT_FCALL                                                   'print_r'
         29        SEND_VAR                                                     !1
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.55 ms | 3620 KiB | 15 Q