3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user_data = [ 'one' => 'one value', 'two' => 'another value', 'three' => 'last value' ]; $fields = [ 'field1' => 'Name', 'field2' => 'Street' ]; $fields_position = [0, 3]; $values = [ 'John', 'Doe', '555 23 58 45', 'Evergreen Terrace' ]; foreach($fields_position as $idx) { $field_name = $fields[$idx]; $user_data[$idx] = $values[$idx]; } /* The result of $user_data must be [ 'one' => 'one value', 'two' => 'another value' 'three' => 'last value' 'field1' => 'John', 'field2' => 'Evergreen Terrace' ]. Because in 0 position of $values is John and in 3 position is 'Evergreen Terrace' */ var_dump($user_data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/gdVG7
function name:  (null)
number of ops:  17
compiled vars:  !0 = $user_data, !1 = $fields, !2 = $fields_position, !3 = $values, !4 = $idx, !5 = $field_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   15     3        ASSIGN                                                   !3, <array>
   22     4      > FE_RESET_R                                       $10     !2, ->12
          5    > > FE_FETCH_R                                               $10, !4, ->12
   23     6    >   FETCH_DIM_R                                      ~11     !1, !4
          7        ASSIGN                                                   !5, ~11
   24     8        FETCH_DIM_R                                      ~14     !3, !4
          9        ASSIGN_DIM                                               !0, !4
         10        OP_DATA                                                  ~14
   22    11      > JMP                                                      ->5
         12    >   FE_FREE                                                  $10
   40    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.14 ms | 1395 KiB | 15 Q