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 "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/4mbG6
function name:  (null)
number of ops:  39
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
   10    17        ECHO                                                     'With+array_merge%3A%0A'
   11    18        INIT_FCALL                                               'json_encode'
         19        INIT_FCALL                                               'array_merge'
         20        SEND_VAR                                                 !1
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $12     
         23        SEND_VAR                                                 $12
         24        DO_ICALL                                         $13     
         25        CONCAT                                           ~14     'input+%2B+source+%7C+', $13
         26        CONCAT                                           ~15     ~14, '%0A'
         27        ECHO                                                     ~15
   12    28        INIT_FCALL                                               'json_encode'
         29        INIT_FCALL                                               'array_merge'
         30        SEND_VAR                                                 !0
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $16     
         33        SEND_VAR                                                 $16
         34        DO_ICALL                                         $17     
         35        CONCAT                                           ~18     'source+%2B+input+%7C+', $17
         36        CONCAT                                           ~19     ~18, '%0A'
         37        ECHO                                                     ~19
   13    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.51 ms | 1000 KiB | 15 Q