So I was wondering for you PHP people out there, who uses Switch?
this is an example of it. It is much cleaner than heaps of if statements, but typically when I talk to friends who do a fair bit of PHP programming they don't seem to even know it exists? Makes code a lot cleaner to read!
Code:
function get_privacy_text($privacyoption){
switch($privacyoption){
case "0":
return "all staff";
break;
case "1":
return "invite only to view";
break;
case "2":
return "system admins only";
break;
default:
return "not set";
}
}
this is an example of it. It is much cleaner than heaps of if statements, but typically when I talk to friends who do a fair bit of PHP programming they don't seem to even know it exists? Makes code a lot cleaner to read!







