3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = '[{ "product_name": "Product1", "qty": "1" }, { "product_name": "Product2", "qty": "2" }, { "product_name": "Product3", "qty": "3" }]'; $array2 = '[{ "product_name": "Product4", "qty": "1" }, { "product_name": "Product3", "qty": "1" }, { "product_name": "Product2", "qty": "1" }]'; $arr1 = json_decode($array1, true); $arr2 = json_decode($array2, true); $result = array_merge($arr1,$arr2); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G8c8m
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array1, !1 = $array2, !2 = $arr1, !3 = $arr2, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%0A+++%22product_name%22%3A+%22Product1%22%2C%0A+++%22qty%22%3A+%221%22%0A%7D%2C%0A%7B%0A+++%22product_name%22%3A+%22Product2%22%2C%0A+++%22qty%22%3A+%222%22%0A%7D%2C%0A%7B%0A+++%22product_name%22%3A+%22Product3%22%2C%0A+++%22qty%22%3A+%223%22%0A%7D%5D'
   15     1        ASSIGN                                                   !1, '%5B%7B%0A+++%22product_name%22%3A+%22Product4%22%2C%0A+++%22qty%22%3A+%221%22%0A%7D%2C%0A%7B%0A+++%22product_name%22%3A+%22Product3%22%2C%0A+++%22qty%22%3A+%221%22%0A%7D%2C%0A%7B%0A+++%22product_name%22%3A+%22Product2%22%2C%0A+++%22qty%22%3A+%221%22%0A%7D%5D'
   27     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   28     7        INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !3, $9
   29    12        INIT_FCALL                                               'array_merge'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !4, $11
   30    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.67 ms | 1395 KiB | 19 Q