3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = array ( array ( "semCategoryDocID" => 5, "semCategoryID" => 8, "docTypeID" => 1, "semCategoryDocRequired" => 0, "semCategoryDocAtom" => 0, "docTypeName" => "ID", ), array ( "semCategoryDocID" => 8, "semCategoryID" => 8, "docTypeID" => 2, "semCategoryDocRequired" => 1, "semCategoryDocAtom" => 1, "docTypeName" => "Passport" ), array ( "semCategoryDocID" => 9, "semCategoryID" => 8, "docTypeID" => 5, "semCategoryDocRequired" => 1, "semCategoryDocAtom" => 0, "docTypeName" => "Request" ), array ( "semCategoryDocID" => 14, "semCategoryID" => 8, "docTypeID" => 8, "semCategoryDocRequired" => 0, "semCategoryDocAtom" => 1, "docTypeName" => "Other", ), array ( "semCategoryDocID" => 15, "semCategoryID" => 8, "docTypeID" => 4, "semCategoryDocRequired" => 0, "semCategoryDocAtom" => 1, "docTypeName" => "Doc GDPR" ) ); $array2 = array ( array ( "applicationDocID" => 54, "applicationID" => 8530, "semCategoryDocID" => 5, "applicationDocName" => "8530_2014-09-09-1739319PAR1.pdf", "applicationDocDate" => "2020-07-14 15:00:07" ), array ( "applicationDocID" => 55, "applicationID" => 8530, "semCategoryDocID" => 9, "applicationDocName" => "8530_2014-09-09-17465716PAR.pdf", "applicationDocDate" => "2020-07-14 15:00:07" ) ); $result = []; foreach ($array1 as $a1) { foreach ($array2 as $a2) { if ($a1["semCategoryDocID"] === $a2["semCategoryDocID"]) { $a1 = array_merge($a1, $a2); } } $result[] = $a1; } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/cEvAN
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $a1, !4 = $a2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   57     1        ASSIGN                                                       !1, <array>
   78     2        ASSIGN                                                       !2, <array>
   79     3      > FE_RESET_R                                           $8      !0, ->21
          4    > > FE_FETCH_R                                                   $8, !3, ->21
   80     5    > > FE_RESET_R                                           $9      !1, ->17
          6    > > FE_FETCH_R                                                   $9, !4, ->17
   81     7    >   FETCH_DIM_R                                          ~10     !3, 'semCategoryDocID'
          8        FETCH_DIM_R                                          ~11     !4, 'semCategoryDocID'
          9        IS_IDENTICAL                                                 ~10, ~11
         10      > JMPZ                                                         ~12, ->16
   82    11    >   INIT_FCALL                                                   'array_merge'
         12        SEND_VAR                                                     !3
         13        SEND_VAR                                                     !4
         14        DO_ICALL                                             $13     
         15        ASSIGN                                                       !3, $13
   80    16    > > JMP                                                          ->6
         17    >   FE_FREE                                                      $9
   85    18        ASSIGN_DIM                                                   !2
         19        OP_DATA                                                      !3
   79    20      > JMP                                                          ->4
         21    >   FE_FREE                                                      $8
   88    22        INIT_FCALL                                                   'print_r'
         23        SEND_VAR                                                     !2
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.75 ms | 479 KiB | 9 Q