Is there such a thing as a configuration option for PHP or anything on a web server for allowing or not arrays that looks like this:
$i['addme']["A".$temp[1]] = $v;
For some reason, this code was working on a Netfirms server and now I changed to a VPS host and it doesn’t keep the value…
Any idea why?
=============
EDIT 1 : more details below:
The exact code:
foreach ($_POST as $k => $v) {
$temp = explode("_", $k);//_p($temp);
if ($temp[0] == "ATTRIBUT") {
$i['addme']["A".$temp[1]] = $v;
// debugging test below
echo $v; // THIS WORKS
echo $i['addme']["A".$temp[1]]; // EMPTY DATA
}
}
- When I print the content of the POST array, I see my data.
- When I print the content of the
$temparray, I see my data - RIGHT after assigning the
$vdata to$i['addme'], I check it and its empty.
In other word, in this script, when I check the $v string, it shows the data, but when i echo the $i string, its empty…
Ideas?
=============
EDIT 2 :
I just tested $ii (2 letter variable) instead of $i and it worked… Why?
Side note : I still want to solve the problem, I don’t want to go in my 20 000 lines of code to change all my 1 letter arrays…
=============
EDIT 3 :
Strangely, when I put $i = array(); before the script, it works.
Why?
I think the author points indirectly to the answer: He says something like “if I use $i, I’ve a problem but if I use $ii, that’s ok”. It’s $i used before for something else? $i is defined as an array and initialized before first use? The code fragment the author presents is called from any other control structure at a higher level?