3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = [ 1031 => [ 'id' => '1031', 'name' => 'TR16', 'price' => 98.75 ], 1032 => [ 'id' => '1032', 'name' => 'TR16G', 'price' => 148.75 ] ]; $newItemIds = [ 1031 => [ 'id' => 1031, 'quantity' => 4 ], 1032 => [ 'id' => 1032, 'quantity' => 2 ] ]; $products_with_quantity = array_replace_recursive($products, $newItemIds); print_r($products_with_quantity);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YQQpF
function name:  (null)
number of ops:  11
compiled vars:  !0 = $products, !1 = $newItemIds, !2 = $products_with_quantity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   30     2        INIT_FCALL                                               'array_replace_recursive'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   31     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149 ms | 1010 KiB | 15 Q