switch and register_globals.
| From: | Gerard Samuel | Date: | Tue, 14 May 2002 14:44:28 +0000 |
| Subject: | switch and register_globals. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-97537@lists.php.net to get a copy of this message | ||
Just looking for opinions/comments of how others are working with switch() while register_globals is off....
With register_globals off, switch() has a little handicap.
ie
switch($foo)
{
....
break;
}
$foo, is now illegal/not set. So far, I've been using this before switch statements.
if (isset($_POST['foo']))
{
$foo = $_POST['foo'];
}
elseif (isset($_GET['foo']))
{
$foo = $_GET['foo'];
}
else
{
$foo = FALSE;
}
Works for me. Ill probably turn it into a function so I dont type as much :)