3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arrays = [ [ "id" => 1, "order_id" => 1, "image_url" => "/resources/filename1" ], [ "id" => 2, "order_id" => 1, "image_url" => "/resources/filename2" ] ]; foreach($arrays as $array) { $result[$array['order_id']][]=$array['image_url']; } print_r($result);
based on PTDlk
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0alpha1
Array ( [1] => Array ( [0] => /resources/filename1 [1] => /resources/filename2 ) )