3v4l.org

run code in 300+ PHP versions simultaneously
<?php $oldArray = [ [ 'id' => 123, 'name' => 'abc', ], [ 'id' => 456, 'name' => 'def', ] ]; $newArray = [ [ 'id' => 456, 'name' => 'ghi', ], [ 'id' => 789, 'name' => 'jkl', ], ]; $expected = [ [ 'id' => 123, 'name' => 'abc', ], [ 'id' => 456, 'name' => 'ghi', ], [ 'id' => 789, 'name' => 'jkl', ], ]; $old = array_column($oldArray,null,'id'); $new = array_column($newArray,null,'id'); $upd = array_values(array_replace_recursive($old, $new)); var_dump($upd == $expected);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmNhZ
function name:  (null)
number of ops:  28
compiled vars:  !0 = $oldArray, !1 = $newArray, !2 = $expected, !3 = $old, !4 = $new, !5 = $upd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   25     2        ASSIGN                                                   !2, <array>
   40     3        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 null
          6        SEND_VAL                                                 'id'
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !3, $9
   41     9        INIT_FCALL                                               'array_column'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 null
         12        SEND_VAL                                                 'id'
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !4, $11
   42    15        INIT_FCALL                                               'array_values'
         16        INIT_FCALL                                               'array_replace_recursive'
         17        SEND_VAR                                                 !3
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $13     
         20        SEND_VAR                                                 $13
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !5, $14
   44    23        INIT_FCALL                                               'var_dump'
         24        IS_EQUAL                                         ~16     !5, !2
         25        SEND_VAL                                                 ~16
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.02 ms | 1013 KiB | 17 Q