note 31800 modified in control-structures.switch by vrana

From: Date: Tue, 17 Aug 2004 13:54:34 +0000
Subject: note 31800 modified in control-structures.switch by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80053@lists.php.net to get a copy of this message
You can also nest switch statements inside case statements: <?php // Set argument handlers $argv = explode(",", urldecode(getenv('QUERY_STRING'))); $argc = array_shift($argv); $argd = array_shift($argv); $arge = array_shift($argv); ?> // Begin switching <?php switch ($argc) { case 'home': { print('This is $argc, home case.'); break; } case 'subsection': { switch ($argd) { case 'links': { switch($arge) { case 'display': { print('This is $arge, subsection,links,display case.'); break; } } } } } } ?> --was-- You can also nest switch statements inside case statements: // Set argument handlers $argv = explode(",", urldecode(getenv('QUERY_STRING'))); $argc = array_shift($argv); $argd = array_shift($argv); $arge = array_shift($argv); // Begin switching switch ($argc) { case 'home': { print('This is $argc, home case.'); break; } case 'subsection': { switch ($argd) { case 'links': { switch($arge) { case 'display': { print('This is $arge, subsection,links,display case.'); break; } } } } } } http://php.net/manual/en/control-structures.switch.php

« previous php.notes (#80053) next »