3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = [ 0 => "test zero", 1 => "test one", 2 => "test two", 3 => "test three" ]; $bar = [ 1 => "test four", 5 => "test five", 3 => "test six", 4 => "test seven" ]; $result = array_diff_key($foo, $bar) + array_combine( $y = array_keys(array_intersect_key($foo, $bar)), array_map(function($x) use ($foo, $bar) { return $foo[$x]."\n".$bar[$x]; }, $y) ) + array_diff_key($bar, $foo); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uOeKS
function name:  (null)
number of ops:  36
compiled vars:  !0 = $foo, !1 = $bar, !2 = $result, !3 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'array_diff_key'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
   19     6        INIT_FCALL                                               'array_combine'
   20     7        INIT_FCALL                                               'array_keys'
          8        INIT_FCALL                                               'array_intersect_key'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        ASSIGN                                           ~9      !3, $8
         15        SEND_VAL                                                 ~9
   21    16        INIT_FCALL                                               'array_map'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuOeKS%3A21%240'
         18        BIND_LEXICAL                                             ~10, !0
         19        BIND_LEXICAL                                             ~10, !1
   24    20        SEND_VAL                                                 ~10
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                         $12     
         25        ADD                                              ~13     $6, $12
   27    26        INIT_FCALL                                               'array_diff_key'
         27        SEND_VAR                                                 !1
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $14     
         30        ADD                                              ~15     ~13, $14
   16    31        ASSIGN                                                   !2, ~15
   28    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FuOeKS%3A21%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uOeKS
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $x, !1 = $foo, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   23     3        FETCH_DIM_R                                      ~3      !1, !0
          4        CONCAT                                           ~4      ~3, '%0A'
          5        FETCH_DIM_R                                      ~5      !2, !0
          6        CONCAT                                           ~6      ~4, ~5
          7      > RETURN                                                   ~6
   24     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FuOeKS%3A21%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.4 ms | 1392 KiB | 25 Q