Is there a better way to write the below, other then using a switch or if/else statement? Like is this a situation where a PHP's varaiable variable ( $$var ) could come to use? If so how would you write this code?
$type = 2;
switch ($type) {
case 1:
$type = 'gif';
break;
case 2:
$type = 'jpg';
break;
case 3:
$type = 'png';
break;
default:
$type = 'jpg';
break;
}