If the pics are always going to have the standard name format of "item".png, you could do this
$availableItemsArray = ("socks", "jacket", "hat", "boxers");
$testItemsArray = ("jacket", "boxers", "monkey hair gloves", "socks", "jodhpurs");
$arrayLength = count($itemsArray); // you could put this in the for loop below .. but its better to only count the array one time and save it, than to count it on each iteration
for($i=0; i < $arrayLength; $i++){
if(in_array($testItemsArray[ $i ], $availableItemsArray) // grabs each item to be compared one by one .. and looks if it is in the array of available items
{
echo "images/" . $testItem[ $i ] . ".png";
}else{
echo "Item doesn't exist";
}
}
You might want to put a strtolower() in there somewhere to deal with capitalization discrepencies