Bu kodu kısaltmak için bir IF üçlü içine yapılabilir? Birden elseif fıkra ile bunu nasıl bilmiyorum
if ($ext == "m") {
$extype = "mp3";
}elseif ($ext == "w") {
$extype = "wav";
}elseif ($ext == "a"){
$extype = "aac";
}
tam fonksiyon olduğunu
function loc($id,$type,$ext) //loc($id,'n',$ext)
{
if (($query = mysql_query("SELECT loc FROM names WHERE id = '".(int)$id."'")) !== false)
{
if (mysql_num_rows($query) > 0)
if ($ext == "m") {
$extype = ".mp3";
}elseif ($ext == "w") {
$extype = ".wav";
}elseif ($ext == "a") {
$extype = ".aac";
}
return '/rec/'.mysql_result($query,0,'loc').$id.'-'.($type=='n'?'n':'s').$extype);
}
return 'Error Not Found';
}