3v4l.org

run code in 300+ PHP versions simultaneously
<?php $answers = [ [ 'questionid' => '28f68dc4-acc6-4ab7-956d-ca41abf3a4c2', 'answer' => 'Antwoord 89', 'extra' => '', ], [ 'questionid' => '28f-28f68dc4-acc6-4ab7-956d-ca41abf3a4c20', 'answer' => 'Antwoord 20', 'extra' => 'Extra informatie 20', ], [ 'questionid' => 'd8f-28f68dc4-acc6-4ab7-956d-ca41abf3a4c20', 'answer' => 'Antwoord 3', 'extra' => '', ], ]; $questions = [ [ 'questionId' => '28f-28f68dc4-acc6-4ab7-956d-ca41abf3a4c20', 'question' => '1. Question 1', 'type' => 'typequestion/question-text-input', ], ]; $indexedQuestions = []; foreach ($questions as $question) { $id = $question['questionId']; $indexedQuestions[$id] = $question; } foreach ($answers as &$answer) { $id = $answer['questionid']; if (isset($indexedQuestions[$id])) { $answer += $indexedQuestions[$id]; unset($answer['questionId']); } } print_r($answers);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
2 jumps found. (Code = 125) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 126) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/CEKhk
function name:  (null)
number of ops:  26
compiled vars:  !0 = $answers, !1 = $questions, !2 = $indexedQuestions, !3 = $question, !4 = $id, !5 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   29     2        ASSIGN                                                   !2, <array>
   30     3      > FE_RESET_R                                       $9      !1, ->10
          4    > > FE_FETCH_R                                               $9, !3, ->10
   31     5    >   FETCH_DIM_R                                      ~10     !3, 'questionId'
          6        ASSIGN                                                   !4, ~10
   32     7        ASSIGN_DIM                                               !2, !4
          8        OP_DATA                                                  !3
   30     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $9
   35    11      > FE_RESET_RW                                      $13     !0, ->21
         12    > > FE_FETCH_RW                                              $13, !5, ->21
   37    13    >   FETCH_DIM_R                                      ~14     !5, 'questionid'
         14        ASSIGN                                                   !4, ~14
   38    15        ISSET_ISEMPTY_DIM_OBJ                         0          !2, !4
         16      > JMPZ                                                     ~16, ->20
   39    17    >   FETCH_DIM_R                                      ~17     !2, !4
         18        ASSIGN_OP                                     1          !5, ~17
   40    19        UNSET_DIM                                                !5, 'questionId'
   35    20    > > JMP                                                      ->12
         21    >   FE_FREE                                                  $13
   44    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.47 ms | 1004 KiB | 15 Q