> -----Original Message----- > From: Marcus Hufvudsson [mailto:[EMAIL PROTECTED] > Sent: 09 July 2003 13:56 > > Hi, Let's get right to it... > When I try to do this: > > <? > echo $_COOKIE['test.1']; > ?> > > It doesn't work (needless to say there is a cookie that goes > by this name) > > So, when I did this: > > <? > foreach($_COOKIE as $cook => $val) { > echo $val ." -> " .$cook ."<br>"; > } > ?> > > I got: > ec1c9edd209143432f36fsd29af410ef27 -> test_1 > > Notice the _ (underscore) instead of . (dot)
Because, when register_globals is set to On, the names of all GET, POST and COOKIE parameters will be used as variable names, they may only contain characters which are legal in PHP variable names. PHP automagically converts all other characters to _ on the fly as they are loaded into the $_GET, $_POST and $_COOKIE arrays and, if register_globals is set, the equivalent global variables. > So I though that you couldn't have dots in your array > names... There's no problem with this -- it's purely that GET, POST and COOKIE names must conform to PHP variable naming rules. This is documented, if somewhat minimally, at http://uk2.php.net/manual/en/language.variables.external.php#language.variab les.external.dot-in-names. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php