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"); foreach ($arr as $string) { //Build array preg_match_all("/ [ ]?([^:]+): ([^;]+)[ ;]? /x", $string, $p); $array = array_combine($p[1], $p[2]); //Print it or do something else with it print_r($array); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 19
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/0cnhZ
function name:  (null)
number of ops:  21
compiled vars:  !0 = $arr, !1 = $string, !2 = $p, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $5      !0, ->19
          2    > > FE_FETCH_R                                               $5, !1, ->19
   15     3    >   INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F+%5B+%5D%3F%28%5B%5E%3A%5D%2B%29%3A+%28%5B%5E%3B%5D%2B%29%5B+%3B%5D%3F+%2Fx'
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !2
          7        DO_ICALL                                                 
   16     8        INIT_FCALL                                               'array_combine'
          9        FETCH_DIM_R                                      ~7      !2, 1
         10        SEND_VAL                                                 ~7
         11        FETCH_DIM_R                                      ~8      !2, 2
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !3, $9
   19    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   13    18      > JMP                                                      ->2
         19    >   FE_FREE                                                  $5
   20    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.99 ms | 1447 KiB | 16 Q