note 20355 deleted from function.parse-str by nlopess

From: Date: Sat, 13 Mar 2004 21:33:39 +0000
Subject: note 20355 deleted from function.parse-str by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66784@lists.php.net to get a copy of this message
Note Submitter: admin@CdnDomainRegistry.ca ---- When returning the results of parse_str() to an array, the key will be renamed if it contains a period. $str = "first=value&second[]=this+works&per.iod[]=another"; parse_str($str, $newArray); echo $newArray; /* prints "Array" */ echo $newArray['second']['0']; /* prints "this works" */ echo $newArray['per.iod']['0']; /* "Undefined index: per.iod " */ /* however...*/ echo $newArray['per_iod']['0']; /* prints "another" */ /* notice the array key has been renamed from per.iod to per_iod */ [editors note: PHP converts . into _ for all variable names passed through the URL]

« previous php.notes (#66784) next »