note 21443 added to function.extract
| From: | destes@php.net | Date: | Mon, 13 May 2002 18:13:41 +0000 |
| Subject: | note 21443 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30590@lists.php.net to get a copy of this message | ||
Extract provides an invaluable way to get around the possibility of the PHP directive
register_globals being off or on. If you're used to register_globals being on, and you're
worried that new PHP 4.2.0 implementations will mess up existing code (because it now defaults to
off), try using this:
if (!empty($_GET)) {
extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}
if (!empty($_POST)) {
extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}
That's from PHPMyAdmin (to give proper credit), and the same thing would probably be useful
elsewhere. Thanks,
Steve
--
http://www.php.net/manual/en/function.extract.php
http://master.php.net/manage/user-notes.php?action=edit+21443
http://master.php.net/manage/user-notes.php?action=delete+21443
http://master.php.net/manage/user-notes.php?action=reject+21443