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);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { ["fileName"]=> string(8) "CAR2.jpg" ["processId"]=> int(112) ["storyId"]=> int(1) ["notes"]=> array(1) { [0]=> array(3) { ["noteId"]=> int(50) ["note"]=> string(14) "this is a note" ["processId"]=> int(112) } } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
174.87 ms | 406 KiB | 5 Q