3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileArr = [ [ 'fileName' => 'CAR.jpg', 'processId' => 111, 'storyId' => 1 , ], [ 'fileName' => 'CAR2.jpg', 'processId' => 112, 'storyId' => 1 , ] ]; $notes = [ [ 'noteId' => 50, 'note' => 'this is a note', 'processId' => 111, ], [ 'noteId' => 50, 'note' => 'this is a note', 'processId' => 112, ], ]; function addNote(array &$array, array $notes) { $array['notes'] = []; foreach ($notes as $note) { if ($note['processId'] == $array['processId']) { $array['notes'][] = $note; } } return $array; } foreach ($fileArr as &$file) { addNote($file, $notes); } var_dump($file);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/u37UL
function name:  (null)
number of ops:  14
compiled vars:  !0 = $fileArr, !1 = $notes, !2 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   41     2      > FE_RESET_RW                                      $5      !0, ->9
          3    > > FE_FETCH_RW                                              $5, !2, ->9
   42     4    >   INIT_FCALL                                               'addnote'
          5        SEND_REF                                                 !2
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0          
   41     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $5
   45    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function addnote:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/u37UL
function name:  addNote
number of ops:  17
compiled vars:  !0 = $array, !1 = $notes, !2 = $note
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   31     2        ASSIGN_DIM                                               !0, 'notes'
          3        OP_DATA                                                  <array>
   32     4      > FE_RESET_R                                       $4      !1, ->14
          5    > > FE_FETCH_R                                               $4, !2, ->14
   34     6    >   FETCH_DIM_R                                      ~5      !2, 'processId'
          7        FETCH_DIM_R                                      ~6      !0, 'processId'
          8        IS_EQUAL                                                 ~5, ~6
          9      > JMPZ                                                     ~7, ->13
   35    10    >   FETCH_DIM_W                                      $8      !0, 'notes'
         11        ASSIGN_DIM                                               $8
         12        OP_DATA                                                  !2
   32    13    > > JMP                                                      ->5
         14    >   FE_FREE                                                  $4
   38    15      > RETURN                                                   !0
   39    16*     > RETURN                                                   null

End of function addnote

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.45 ms | 1017 KiB | 15 Q