3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = ["a" => 1, "b" => 2, "c" => 3]; $input = ["d" => 4, "b" => 10]; echo "With + operator:\n"; echo "input + source | " . json_encode($input + $source) . PHP_EOL; echo "source + input | " . json_encode($source + $input) . PHP_EOL; echo "source + input + source | " . json_encode($source + ($input + $source)) . PHP_EOL; echo "With array_merge:\n"; echo "input + source | " . json_encode(array_merge($input, $source)) . PHP_EOL; echo "source + input | " . json_encode(array_merge($source, $input)) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l2lEl
function name:  (null)
number of ops:  47
compiled vars:  !0 = $source, !1 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ECHO                                                     'With+%2B+operator%3A%0A'
    7     3        INIT_FCALL                                               'json_encode'
          4        ADD                                              ~4      !1, !0
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7        CONCAT                                           ~6      'input+%2B+source+%7C+', $5
          8        CONCAT                                           ~7      ~6, '%0A'
          9        ECHO                                                     ~7
    8    10        INIT_FCALL                                               'json_encode'
         11        ADD                                              ~8      !0, !1
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                         $9      
         14        CONCAT                                           ~10     'source+%2B+input+%7C+', $9
         15        CONCAT                                           ~11     ~10, '%0A'
         16        ECHO                                                     ~11
    9    17        INIT_FCALL                                               'json_encode'
         18        ADD                                              ~12     !1, !0
         19        ADD                                              ~13     !0, ~12
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        CONCAT                                           ~15     'source+%2B+input+%2B+source+%7C+', $14
         23        CONCAT                                           ~16     ~15, '%0A'
         24        ECHO                                                     ~16
   11    25        ECHO                                                     'With+array_merge%3A%0A'
   12    26        INIT_FCALL                                               'json_encode'
         27        INIT_FCALL                                               'array_merge'
         28        SEND_VAR                                                 !1
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $17     
         31        SEND_VAR                                                 $17
         32        DO_ICALL                                         $18     
         33        CONCAT                                           ~19     'input+%2B+source+%7C+', $18
         34        CONCAT                                           ~20     ~19, '%0A'
         35        ECHO                                                     ~20
   13    36        INIT_FCALL                                               'json_encode'
         37        INIT_FCALL                                               'array_merge'
         38        SEND_VAR                                                 !0
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $21     
         41        SEND_VAR                                                 $21
         42        DO_ICALL                                         $22     
         43        CONCAT                                           ~23     'source+%2B+input+%7C+', $22
         44        CONCAT                                           ~24     ~23, '%0A'
         45        ECHO                                                     ~24
   14    46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.46 ms | 1004 KiB | 15 Q