3v4l.org

run code in 300+ PHP versions simultaneously
<?php $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones', ), array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); $records2 = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones', ), array( 'id' => 5624, 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); $first = array_column($records, null, 'id'); $second = array_column($records2, null, 'id'); $third = $first + $second; // if you need to reset indexes // $third = array_values($third); echo print_r($third);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K3l58
function name:  (null)
number of ops:  21
compiled vars:  !0 = $records, !1 = $records2, !2 = $first, !3 = $second, !4 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        ASSIGN                                                   !1, <array>
   49     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 'id'
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
   50     8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 null
         11        SEND_VAL                                                 'id'
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !3, $9
   51    14        ADD                                              ~11     !2, !3
         15        ASSIGN                                                   !4, ~11
   54    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $13     
         19        ECHO                                                     $13
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.99 ms | 1002 KiB | 15 Q