Von professionellen Übersetzern, Unternehmen, Websites und kostenlos verfügbaren Übersetzungsdatenbanken.
switch.
switch
Letzte Aktualisierung: 2011-10-24
Nutzungshäufigkeit: 1
Qualität:
뒤에 값이 오는 식으로 구성된 인수 목록을 평가합니다. switch 함수는 자신이 전달한 식과 연관된 값을 구합니다.
evaluates a list of arguments, consisting of an expression followed by a value. the switch function returns a value that is associated with the expression that is passed by this function.
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;
it does not change the working directory to that of the script. (-c switch kept for compatibility)
there are certain php.ini directives which are overriden by the cli sapi because they do not make sense in shell environments:
though the cgi sapi provides a way to suppress http headers, there's no equivalent switch to enable them in the cli sapi.
though the cgi sapi provides a way to suppress http headers, there 's no equivalent switch to enable them in the cli sapi.
cli is started up in quiet mode by default, though the -q switch is kept for compatibility so that you can use older cgi scripts.
it does not change the working directory to that of the script. (-c switch kept for compatibility)
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: