RE: [PHP] Function and return...
| From: | Vamsi Nath | Date: | Thu, 27 Jul 2000 10:26:51 +0000 |
| Subject: | RE: [PHP] Function and return... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8515@lists.php.net to get a copy of this message | ||
Making $HTTP_COOKIE_VARS global inside your function should fix your
problem:
function getcookie($name) {
global $HTTP_COOKIE_VARS;
return $HTTP_COOKIE_VARS[$name];
}
--Vamsi
http://php.vamsi.net
-----Original Message-----
From: Martin Thoma [mailto:martin@radiok2r.de]
Sent: Thursday, July 27, 2000 6:12 AM
To: php-general@lists.php.net
Subject: [PHP] Function and return...
Function and return...
The following code works fine:
print $HTTP_COOKIE_VARS[$cookie_name];
The following code on the same place does not (an empty string is
printed):
print getCookie($cookie_name);
function getCookie($name)
{ return $HTTP_COOKIE_VARS[$name];
}
Why ?
Regards
Martin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net