3v4l.org

run code in 500+ PHP versions simultaneously
<?php $keys = [ 'staff_first_name' => null, 'staff_last_name' => null, 'staff_years' => null ]; $submitted_values = [ 'first_name' => 'jon', 'last_name' => 'doe', 'years' => 5 ]; $keyMap = [ 'staff_first_name' => 'first_name', 'staff_last_name' => 'last_name', 'staff_years' => 'years' ]; foreach ($keys as $key => &$value) { $value = $submitted_values[$keyMap[$key] ?? ''] ?? $value; } var_export($keys);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/mN79Q
function name:  (null)
number of ops:  19
compiled vars:  !0 = $keys, !1 = $submitted_values, !2 = $keyMap, !3 = $value, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    9     1        ASSIGN                                                       !1, <array>
   15     2        ASSIGN                                                       !2, <array>
   21     3      > FE_RESET_RW                                          $8      !0, ->14
          4    > > FE_FETCH_RW                                          ~9      $8, !3, ->14
          5    >   ASSIGN                                                       !4, ~9
   22     6        FETCH_DIM_IS                                         ~11     !2, !4
          7        COALESCE                                             ~12     ~11
          8        QM_ASSIGN                                            ~12     ''
          9        FETCH_DIM_IS                                         ~13     !1, ~12
         10        COALESCE                                             ~14     ~13
         11        QM_ASSIGN                                            ~14     !3
         12        ASSIGN                                                       !3, ~14
   21    13      > JMP                                                          ->4
         14    >   FE_FREE                                                      $8
   24    15        INIT_FCALL                                                   'var_export'
         16        SEND_VAR                                                     !0
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.69 ms | 1777 KiB | 14 Q