3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ 0 => 'Data 1 Table 1', 1 => null, 2 => 'Data 2 Table 1', 3 => null, 4 => null, 5 => 'Data 3 Table 1', ]; $arr2 = [ 0 => 'Data 1 Table 2', 1 => 'Data 2 Table 2', 2 => 'Data 3 Table 2', ]; $result = array_replace($arr1,array_combine(array_keys(array_intersect($arr1, [null])), $arr2)); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZm32
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'array_replace'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'array_combine'
          5        INIT_FCALL                                               'array_keys'
          6        INIT_FCALL                                               'array_intersect'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !2, $8
   20    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.34 ms | 1001 KiB | 18 Q