3v4l.org

run code in 500+ PHP versions simultaneously
<?php $VitalInfo_array = array("Title","ean","upc","ProductImageName","CdnUri","ASIN"); $Price_array = array("ListPrice","Status","ActualPrice","ProductID"); $new_array = array(); $old_array = Array ( "0" => Array ( "Title" => "HoMedics MAN-300", "ean" => "31262006288", "upc" => "31262006288", "ProductImageName" => "", "CdnUri" => "", "ASIN" => "B000050FEU", "ListPrice" => "129.99", "Status" => "2", "ActualPrice" => "129.99", "ProductID" => "5286728", ) ); //print_r($old_array); foreach($old_array as $key_old => $val_old) { foreach($val_old as $key => $val) { if(in_array($key, $VitalInfo_array)) { //$temp_val = $key=>$val; $new_array[$key_old]['VitalInfo'][$key] = $val; } else { //$temp_val = $key=>$val; $new_array[$key_old]['Price'][$key] = $val; } } } print_r($new_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 24
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 22
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/KgD3Z
function name:  (null)
number of ops:  29
compiled vars:  !0 = $VitalInfo_array, !1 = $Price_array, !2 = $new_array, !3 = $old_array, !4 = $val_old, !5 = $key_old, !6 = $val, !7 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2        ASSIGN                                                       !2, <array>
    6     3        ASSIGN                                                       !3, <array>
   24     4      > FE_RESET_R                                           $12     !3, ->24
          5    > > FE_FETCH_R                                           ~13     $12, !4, ->24
          6    >   ASSIGN                                                       !5, ~13
   26     7      > FE_RESET_R                                           $15     !4, ->22
          8    > > FE_FETCH_R                                           ~16     $15, !6, ->22
          9    >   ASSIGN                                                       !7, ~16
   28    10        FRAMELESS_ICALL_2                in_array            ~18     !7, !0
         11      > JMPZ                                                         ~18, ->17
   31    12    >   FETCH_DIM_W                                          $19     !2, !5
         13        FETCH_DIM_W                                          $20     $19, 'VitalInfo'
         14        ASSIGN_DIM                                                   $20, !7
         15        OP_DATA                                                      !6
   28    16      > JMP                                                          ->21
   36    17    >   FETCH_DIM_W                                          $22     !2, !5
         18        FETCH_DIM_W                                          $23     $22, 'Price'
         19        ASSIGN_DIM                                                   $23, !7
         20        OP_DATA                                                      !6
   26    21    > > JMP                                                          ->8
         22    >   FE_FREE                                                      $15
   24    23      > JMP                                                          ->5
         24    >   FE_FREE                                                      $12
   40    25        INIT_FCALL                                                   'print_r'
         26        SEND_VAR                                                     !2
         27        DO_ICALL                                                     
         28      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
376.69 ms | 2747 KiB | 14 Q