3v4l.org

run code in 500+ PHP versions simultaneously
<?php $first = Array( Array( 'id' => 5, 'name' => 'Education', ), Array( 'id' => 4, 'name' => 'Computers', ), Array( 'id' => 7, 'name' => 'Science', ), Array( 'id' => 1, 'name' => 'Sports', ) ); $second = Array( Array( 'id' => 1, 'title' => 'Sport', ), Array( 'id' => 7, 'title' => 'Sci', ), Array( 'id' => 4, 'title' => 'Comp', ), Array( 'id' => 5, 'title' => 'Edu', ) ); $first = array_column($first, null, 'id'); $second = array_column($second, null, 'id'); $result = array_values(array_replace_recursive($first, $second)); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ndv2j
function name:  (null)
number of ops:  26
compiled vars:  !0 = $first, !1 = $second, !2 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   22     1        ASSIGN                                                       !1, <array>
   41     2        INIT_FCALL                                                   'array_column'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     null
          5        SEND_VAL                                                     'id'
          6        DO_ICALL                                             $5      
          7        ASSIGN                                                       !0, $5
   42     8        INIT_FCALL                                                   'array_column'
          9        SEND_VAR                                                     !1
         10        SEND_VAL                                                     null
         11        SEND_VAL                                                     'id'
         12        DO_ICALL                                             $7      
         13        ASSIGN                                                       !1, $7
   43    14        INIT_FCALL                                                   'array_values'
         15        INIT_FCALL                                                   'array_replace_recursive'
         16        SEND_VAR                                                     !0
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                             $9      
         19        SEND_VAR                                                     $9
         20        DO_ICALL                                             $10     
         21        ASSIGN                                                       !2, $10
   45    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:
161.44 ms | 2746 KiB | 17 Q