mercredi 3 avril 2019

What is the smartest way to define values in function?

Is there any smarter / better / faster / easier way to define values in PHP functions?

I am using:

function get_user($id){
if($id == "1"){
return "Ram";
}
elseif($id == "2"){
return "Shyam";
}
elseif($id == "5"){
return "Ramu";
}
elseif($id == "7"){
return "Raman";
}
elseif($id == "8"){
return "Laxman";
}
elseif($id == "9"){
return "Bharat";
}
}

Aucun commentaire:

Enregistrer un commentaire