3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_data = "5:7|4:1|504:2|1:3|"; $data = array(); foreach (explode("|", $your_data) as $part) { $pieces = explode(':', $part); // Assumes we have 2 pieces, might want to make sure here... $data[$pieces[0]] = $pieces[1]; } var_export($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/oq3Rb
function name:  (null)
number of ops:  23
compiled vars:  !0 = $your_data, !1 = $data, !2 = $part, !3 = $pieces
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '5%3A7%7C4%3A1%7C504%3A2%7C1%3A3%7C'
    5     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%7C'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->18
          7    > > FE_FETCH_R                                               $7, !2, ->18
    8     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%3A'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !3, $8
   11    13        FETCH_DIM_R                                      ~10     !3, 0
         14        FETCH_DIM_R                                      ~12     !3, 1
         15        ASSIGN_DIM                                               !1, ~10
         16        OP_DATA                                                  ~12
    6    17      > JMP                                                      ->7
         18    >   FE_FREE                                                  $7
   13    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.03 ms | 1011 KiB | 15 Q