$PROPERTY_CODE = array("morePhotos", "photo");
foreach ($PROPERTY_CODE as $code) {
$res = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $arFields["ID"], "sort", "asc", array("CODE" => $code));
while ($ob = $res->GetNext()) {
.........
}
}