3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( array("id" => "1","name"=>"John"), array("id" => "2","name"=>"Peter"), array("id" => "3","name"=>"Tom"), array("id" => "12","name"=>"Astro") ); $array2 = array( array("id" => "1","second_name"=>"Lim"), array("id" => "2","second_name"=>"Parker"), array("id" => "3","second_name"=>"PHP") ); $result = array_column($array1, null, 'id'); foreach ($array2 as $row) { $result[$row['id']]['second_name'] = $row['second_name']; } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/2XFvf
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   16     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 'id'
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
   17     8      > FE_RESET_R                                       $8      !1, ->16
          9    > > FE_FETCH_R                                               $8, !3, ->16
   18    10    >   FETCH_DIM_R                                      ~9      !3, 'id'
         11        FETCH_DIM_R                                      ~12     !3, 'second_name'
         12        FETCH_DIM_W                                      $10     !2, ~9
         13        ASSIGN_DIM                                               $10, 'second_name'
         14        OP_DATA                                                  ~12
   17    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $8
   20    17        INIT_FCALL                                               'var_export'
         18        INIT_FCALL                                               'array_values'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21        SEND_VAR                                                 $13
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.04 ms | 1077 KiB | 16 Q