Possible bug? (was Re: [PHP] Arrays: Please help before I go insane?)
| From: | Chris Boget | Date: | Thu, 06 Jun 2002 20:42:48 +0000 |
| Subject: | Possible bug? (was Re: [PHP] Arrays: Please help before I go insane?) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101021@lists.php.net to get a copy of this message | ||
> In that case, split it up into two-steps, to only init the
> array if you need to.... i'm not really sure how the rest of
> your code is -- you could probably do this a nicer way,
> but this will work:
> if (!is_array($ary["this"]))
> $ary["this"] = array();
> $ary["this"]["that"] = 1;
This is all well and good. But I'm already doing that last one and it's
that last that is getting messed up.
Again, if you look at the page I gave the link for, you'll see where it
says:
currentBranch[other][joe] = Array
(all good) but the next line it says:
Passing to getParentNodes: currentBranch[joe][monster] = SET
which it shouldn't. Where it says "SET" it should say "Array". This
is what my code is doing:
--------------------------
$currentBranch["$nodeName"]["{$nodeInfo[parent]}"] = "SET";
echo "Passing to getParentNodes:
currentBranch[$nodeName][{$nodeInfo[parent]}] = " .
$currentBranch["$nodeName"] . "<br>\n";
--------------------------
$nodeInfo[parent] is a valid value. So $currentBranch["$nodeName"]
should be an array after that. However, by some miracle (or bug in
PHP), instead of printing out "Array", it's print out "SET". And I have
no idea why it's doing that in my code. The above works fine by itself,
however in my function it doesn't *even though they are doing the same
things with no other code between*.
Chris