Карта сайта Интеллектуальная поисковая системаДобавить свою ссылку по ключевому запросуПоисковая система v3.kz поможет ускорить индексацию вашего сайта выводит в Топ |
|
Not the answer youre looking for? Browse other questions tagged php switch-statement or ask your own question. The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. Use the switch statement to select one of many blocks of code to be executed. In addition to the if statement, PHP provides switch statement that allows you to execute a code block conditionally. <html> <head><title>A switch Statement</title></head> <body> <div> <?php $satisfied = "no"; switch ( $satisfied ) { case "very": print "very"; break; case "no": print "no"; break; default: print "default"; } ?> </div> </body> </html>. <html> <head> <title>A switch Statement</title> </head> <body> <?php... A simple switch statement. switch($bar) { case 4: echo "This is not the number youre looking for.\n"; $foo = 92 In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via a multiway branch. but if you want to use a switch/case, I dont know any easier way. HTH Martin. > -----Original Message----- > From: CF High [mailto:noah@newminddesign.com] > Sent: Monday, March 03, 2003 1:41 PM > To: php-general@lists.php.net > Subject: [PHP]... I would like to program a SWITCH statement using PHP in which several values should lead to the same condition. Using switch to test for multiple values. <? $action = "ADD"; switch ($action) { case "ADD": echo "Perform actions for adding." Информация взята v3.kz |
загрузка...
|