3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = Array ( 0 => Array ( "num" => 1, "name" => "name 1", "epg_channel_id" => "ch111", "added" => "1505435915", ), 1 => Array ( "num" => 2, "name" => "name 2", "epg_channel_id" => "ch222", "added" => "1505435915", ), 2 => Array ( "num" => 3, "name" => "name 3", "epg_channel_id" => "ch333", "added" => "1505435915", ), 3 => Array ( "num" => 4, "name" => "name 4", "epg_channel_id" => "ch444", "added" => "1505435915", ), ); $arr2 = Array ( 0 => Array ( "ch000" => "Um9jayBJbiBSaW8=" ), 1 => Array ( "ch111" => "Um9jayBJbiBSaW8=" ), 2 => Array ( "ch222" => "Um9jayBJbiBSaW8=" ), 3 => Array ( "ch333" => "Um9jayBJbiBSaW8=" ), 4 => Array ( "ch444" => "Um9jayBJbiBSaW8=" ), ); $new_array = array(); foreach($arr1 as $key=>$value) { foreach($arr2 as $key1=>$value1) { foreach($value1 as $key2=>$value2) { if($key2 == $value['epg_channel_id']) { $value[$key2]=$value2; } } } $new_array[$key]=$value; } print_r($new_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/8X61L
function name:  (null)
number of ops:  29
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $new_array, !3 = $value, !4 = $key, !5 = $value1, !6 = $key1, !7 = $value2, !8 = $key2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   34     1        ASSIGN                                                   !1, <array>
   57     2        ASSIGN                                                   !2, <array>
   58     3      > FE_RESET_R                                       $12     !0, ->24
          4    > > FE_FETCH_R                                       ~13     $12, !3, ->24
          5    >   ASSIGN                                                   !4, ~13
   60     6      > FE_RESET_R                                       $15     !1, ->20
          7    > > FE_FETCH_R                                       ~16     $15, !5, ->20
          8    >   ASSIGN                                                   !6, ~16
   62     9      > FE_RESET_R                                       $18     !5, ->18
         10    > > FE_FETCH_R                                       ~19     $18, !7, ->18
         11    >   ASSIGN                                                   !8, ~19
   64    12        FETCH_DIM_R                                      ~21     !3, 'epg_channel_id'
         13        IS_EQUAL                                                 !8, ~21
         14      > JMPZ                                                     ~22, ->17
   66    15    >   ASSIGN_DIM                                               !3, !8
         16        OP_DATA                                                  !7
   62    17    > > JMP                                                      ->10
         18    >   FE_FREE                                                  $18
   60    19      > JMP                                                      ->7
         20    >   FE_FREE                                                  $15
   70    21        ASSIGN_DIM                                               !2, !4
         22        OP_DATA                                                  !3
   58    23      > JMP                                                      ->4
         24    >   FE_FREE                                                  $12
   72    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 1011 KiB | 14 Q