testing for value in $HTTP_COOKIE_VARS
| From: | Steve Yates | Date: | Wed, 03 Apr 2002 19:13:58 +0000 |
| Subject: | testing for value in $HTTP_COOKIE_VARS | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-12920@lists.php.net to get a copy of this message | ||
With PHP 4.1.x defaulting to turning off the automatically registered global
variables, I am trying to code in such a way that the code will work on a
server running 4.0.x as well. However I'm having trouble testing for the
existence of variables.
For example, given $HTTP_COOKIE_VARS...if the value $HTTP_COOKIE_VARS['foo']
does not exist PHP spits out a warning about an undefined index. Yet this
is what I observe (given the cookie is defined):
in_array('mycookie', $HTTP_COOKIE_VARS) == false
echo array_values($HTTP_COOKIE_VARS) prints "Array"
$HTTP_COOKIE_VARS['mycookie'] == 'myvalue'
How can this be? Is there a better way to test for a cookie's existence
besides in_array()?
I should note that before changing to the array notation, $mycookie ==
'myvalue' with PHP making the assignments. For the record, my testbed is
PHP 4.1.2 on IIS 4.0 as a CGI app.
PS--I'm posting this to the .windows group since the .version4 group doesn't
allow posting??
Thanks,
- Steve Yates
- Why did Shakespeare use so many famous quotations in his work?
/ Taglines by Taglinator 2.5 - www.srtware.com /