Is there a more efficient/elegant way to write this bit of code:
$arr1 = array(
"weedoit3",
"alambic3",
"darwinefficiencyscared",
"darwinmoneyscared",
"darwin5scared");
$arr2 = array(
"darwingouroo",
"weedoit4",
"darwin5",
"darwinefficiency",
"darwinmoney",
"pj_half",
"pj_pole");
$imgArray = array(
'<img src="images/mail26bg.jpg" width="1440" height="810" class="thiefBg" />',
'<img src="images/mail25bg.jpg" width="819" height="1024" class="thiefBg" />',
'<img src="images/mai01.jpg" width="1440" height="960" class="thiefBg" />',
'<img src="images/mai02.jpg" width="1440" height="960" class="thiefBg" />',
'<img src="images/mai03.jpg" width="1440" height="1081" class="thiefBg" />');
if (in_array($_GET['ref'], $arr1)) {
echo $imgArray[0];
}
else if (in_array($_GET['ref'], $arr2)) {
echo $imgArray[1];
}
else if ($_GET['ref'] == "darwin4" || $_GET['ref'] == "darwinenquete") {
echo $imgArray[2];
}
else if ($_GET['ref'] == "darwinscared") {
echo $imgArray[3];
}
else if ($_GET['ref'] == "mai03") {
echo $imgArray[4];
}
Make a map of ref to index.