3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-type: text/plain'); $metaarr = array( array( "post_id" => '34', "meta_key" => "product_shops_0_price", "meta_value"=> "25" ), array( "post_id" => '34', "meta_key" => "product_shops_0_price_old", "meta_value"=> "45" ), array( "post_id" => '34', "meta_key" => "product_shops_1_price", "meta_value"=> "25" ), array( "post_id" => '34', "meta_key" => "product_shops_1_price_old", "meta_value"=> "45" ) ); $map = array(); foreach ($metaarr as $key => $value) { $splarr = preg_match('/^(product_shops_\d*)_(\S*)/', $value['meta_key'], $matches); $product_offset = $matches[1]; $map[$value['post_id']][$product_offset][$value['meta_key']] = $value['meta_value']; } print_r($map);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 25
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/hIYmZ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $metaarr, !1 = $map, !2 = $value, !3 = $key, !4 = $splarr, !5 = $matches, !6 = $product_offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-type%3A+text%2Fplain'
          2        DO_ICALL                                                 
    3     3        ASSIGN                                                   !0, <array>
   26     4        ASSIGN                                                   !1, <array>
   27     5      > FE_RESET_R                                       $10     !0, ->25
          6    > > FE_FETCH_R                                       ~11     $10, !2, ->25
          7    >   ASSIGN                                                   !3, ~11
   29     8        INIT_FCALL                                               'preg_match'
          9        SEND_VAL                                                 '%2F%5E%28product_shops_%5Cd%2A%29_%28%5CS%2A%29%2F'
         10        FETCH_DIM_R                                      ~13     !2, 'meta_key'
         11        SEND_VAL                                                 ~13
         12        SEND_REF                                                 !5
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !4, $14
   30    15        FETCH_DIM_R                                      ~16     !5, 1
         16        ASSIGN                                                   !6, ~16
   31    17        FETCH_DIM_R                                      ~18     !2, 'post_id'
         18        FETCH_DIM_R                                      ~21     !2, 'meta_key'
         19        FETCH_DIM_R                                      ~23     !2, 'meta_value'
         20        FETCH_DIM_W                                      $19     !1, ~18
         21        FETCH_DIM_W                                      $20     $19, !6
         22        ASSIGN_DIM                                               $20, ~21
         23        OP_DATA                                                  ~23
   27    24      > JMP                                                      ->6
         25    >   FE_FREE                                                  $10
   33    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.55 ms | 1001 KiB | 16 Q