3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mediaarray = array( array( 'file_type_id'=>'first file', 'other_stuff'=>'first other' ), array( 'file_type_id'=>'second file', 'other_stuff'=>'second other' ) ); $mediafiletype = array( array( 'id'=>'blabla', 'other'=>'first other' ), array( 'id'=>'second file', 'other'=>'second other' ) ); $baseUrlKeyMediaArray = array(); $NotbaseUrlKeyMediaArray = array(); foreach ($mediaarray as $key => $mavalue) { $match = false; foreach ($mediafiletype as $mftvalue) { if ($mavalue['file_type_id'] == $mftvalue['id']) { $pathname = $mftvalue['base_url']; $baseUrlKeyMediaArray[$pathname] = $mavalue; $match = true; } } if(! $match) { $NotbaseUrlKeyMediaArray[] = $mavalue; } } print_r($baseUrlKeyMediaArray); echo "<br />"; print_r($NotbaseUrlKeyMediaArray);

preferences:
34.22 ms | 402 KiB | 5 Q