이 문장을 switch 문으로 바꾸려면 어떻게..?

kurtof27의 이미지

if (strstr("$code","seoul")){$location='서울';} else echo "";
if (strstr("$code","gyeonggi")){$location='경기';} else echo "";
if (strstr("$code","kangneung")){$location='강릉';} else echo "";
if (strstr("$code","gwangju")){$location='광주';} else echo "";
if (strstr("$code","gunsan")){$location='군산';} else echo "";
if (strstr("$code","daegu")){$location='대구';} else echo "";
if (strstr("$code","daejeon")){$location='대전';} else echo "";

위구문을 switch 문으로 변환하려하는데 도저히 모르겠네요..
제발 알려주세요.

nachnine의 이미지

just google.

http://www.linuxlab.co.kr/docs/10-4.htm

find `switch`

http://www.linuxlab.co.kr/docs/1999-1.htm

셸 부분만 일독을 권해드려요~

kurtof27의 이미지

이건 php로 하려는 건데 먼가 오해가..