전문 번역가, 번역 회사, 웹 페이지 및 자유롭게 사용할 수 있는 번역 저장소 등을 활용합니다.
switch.
switch
마지막 업데이트: 2011-10-24
사용 빈도: 1
품질:
switch 문에 대해서도 alternative syntax가 지원된다. 자세한 내용은 alternative syntax for control structures 를 살펴보자
switch ($i): case 0: print "i equals 0"; break; case 1: print "i equals 1"; break; case 2: print "i equals 2"; break; default: print "i is not equal to 0, 1 or 2"; endswitch;
switch 문은 내용상 동일한 표현식의 if문을 나열한 것과 비슷하다. 많은 경우에 한 변수를 여러 다른 값과 비교하여, 두개의 값이 같는냐에 따라 서로 다른 코드들이 수행되기를 원하는 때가 있다. 바로 이런 경우에 switch 문이 사용된다.
in many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to.
parses and executed the given filename to the -f option. this switch is optional and can be left out. only providing the filename to execute is sufficient.
$php -c / custom / directory / my_script.php $php -c / custom / directory / custom-file.ini my_script.php
참고: read the example carefully, there are no beginning or ending tags! the -r switch simply does not need them. using them will lead to a parser error.
this gives the powerful ability to dynamically create php code and feed it to the binary, as shown in this (fictional) example: