PHP로 사용자 모듈을 구축하고 있습니다. 그것은 텍스트 기반의 사용자 유형을 읽고는 보고서보기 권한을 관리 할 수있는 숫자 값을 할당합니다여러 if 문을 단순화하십시오.
if ($usr_type == "Architect"){ $usr_rights = 0; }
if ($usr_type == "Director"){ $usr_rights = 1; }
if ($usr_type == "Manager"){ $usr_rights = 2; }
if ($usr_type == "Associate"){ $usr_rights = 3; }
if ($usr_type == "Assistant"){ $usr_rights = 4; }
if ($usr_type == "External"){ $usr_rights = 5; }
이 할 수있는 간단하고, 더 우아한 방법이 있나요를?
참고 : 아직 본 것이 아닌 경우 여기 (http://stackoverflow.com/tour)에서 사이트를 살펴보고 사이트 작동 방식을 확인할 수 있습니다. – Rizier123
Thanks @ Rizier123! – Architect