Bug #16369 Updated: parse_str renames keys

From: Date: Mon, 01 Apr 2002 02:29:16 +0000
Subject: Bug #16369 Updated: parse_str renames keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-3710@lists.php.net to get a copy of this message
ID: 16369 Updated by: rasmus@php.net Reported By: admin@internettech.ca -Status: Open +Status: Bogus Bug Type: Strings related Operating System: win2000 adv server PHP Version: 4.0.6 New Comment: That's on purpose since a . is not a legal character in a variable name. Previous Comments: ------------------------------------------------------------------------ [2002-03-31 21:27:24] admin@internettech.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 */ Glen ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16369&edit=1

« previous php.bugs (#3710) next »