3v4l.org

run code in 300+ 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 = 31
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 27
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/iEZgo
function name:  (null)
number of ops:  36
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, ->31
          3    > > FE_FETCH_R                                               $8, !2, ->31
   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, ->27
         10    > > FE_FETCH_R                                               $11, !4, ->27
   16    11    >   INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%3A'
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !5, $12
   17    16        INIT_FCALL                                               'trim'
         17        FETCH_DIM_R                                      ~14     !5, 0
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        INIT_FCALL                                               'trim'
         21        FETCH_DIM_R                                      ~17     !5, 1
         22        SEND_VAL                                                 ~17
         23        DO_ICALL                                         $18     
         24        ASSIGN_DIM                                               !3, $15
         25        OP_DATA                                                  $18
   15    26      > JMP                                                      ->10
         27    >   FE_FREE                                                  $11
   19    28        ASSIGN_DIM                                               !1
         29        OP_DATA                                                  !3
   13    30      > JMP                                                      ->3
         31    >   FE_FREE                                                  $8
   22    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !1
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.99 ms | 1462 KiB | 16 Q