3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mapping = [ "AccountId" => "account_id", "Id" => "master_id", "Name" => "name" ]; $input = [ "AccountId" => "18", "Id" => "53600065", "Name" => "Awesome Test Company From SS", "Financial" => [ "vat" => "12345", ] ]; $output = []; foreach ($mapping as $from => $to) { if (array_key_exists($from, $input)) { $output[$to] = $input[$from]; } } var_dump($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/aR5ri
function name:  (null)
number of ops:  17
compiled vars:  !0 = $mapping, !1 = $input, !2 = $output, !3 = $to, !4 = $from
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, <array>
   20     3      > FE_RESET_R                                       $8      !0, ->12
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->12
          5    >   ASSIGN                                                   !4, ~9
   21     6        ARRAY_KEY_EXISTS                                         !4, !1
          7      > JMPZ                                                     ~11, ->11
   22     8    >   FETCH_DIM_R                                      ~13     !1, !4
          9        ASSIGN_DIM                                               !2, !3
         10        OP_DATA                                                  ~13
   20    11    > > JMP                                                      ->4
         12    >   FE_FREE                                                  $8
   26    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.98 ms | 1395 KiB | 15 Q