Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

[2002-01-13 22:32 UTC] jimmy at harlindong dot com

$c should not have been affected by the assignment to $b because $c should only be a copy to $a.
What happened is the first echo shows 5 and after assignment to $b, the content of $c changes to 1 when it should stay as 5.

This has to do with the fact we don't deep-search when we copy values. $a is not a reference, but has an element inside it which is a reference. Therefore, when $a is copied to $c, and no deep search is made, $c ends up having that reference inside of it as well.
It may be possible to fix, but right now I'm just wanted to add the analysis here...