note 10508 added to Array Functions

From: Date: Mon, 08 Jan 2001 14:52:05 +0000
Subject: note 10508 added to Array Functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-9476@lists.php.net to get a copy of this message
Be careful if you want to submit a variable as an associative array. If for some reason you use indexes that begin with a number - for instance some dynamically display ID number : <input type="textfield" name="vars[8eccbad8e776e]"> It seems to be a rare case but I needed to code that stuff. The bug here comes from the fact the browser "urlencodes" the name of the field. The array is actually transmitted but you can't use the "each()" function on It. However I can swear you the array is not empty and - that's worse - the correct data is stored at the correct index (is knew It making 'echo $vars["8ecc..."]'). The less boring solution I found is to put an "_" before any index. Then you will surely find a way to remove it - using "preg_replace" for instance. http://www.php.net/manual/ref.array.php

« previous php.notes (#9476) next »