Hi!
Under PHP 4.3.10, the following simple code behaves as expected: $b[1]
and $c are not modified by the final assignment to $a[1]:
Code 1:
********
$a[1] = 1;
$b[1] = 2;
$c = 3;
$a = $b;
$a[1] = 7;
// resulting mappings:
// $a[1] ... 7
// $b[2] ... 2
// $c ...... 3
However, the following two codes result in changes to $b[1] and $c, the
only difference to the previous code being the connection between $b[1]
and $c via a reference:
Code 2:
********
$a[1] = 1;
$b[1] = 2;
$c =& $b[1];
$a = $b;
$a[1] = 7;
// resulting mappings:
// $a[1] ... 7
// $b[2] ... 7
// $c ...... 7
Code 3:
********
$a[1] = 1;
$b[1] =& $c;
$c = 2;
$a = $b;
$a[1] = 7;
// resulting mappings:
// $a[1] ... 7
// $b[2] ... 7
// $c ...... 7
Is this effect intended? If it is, is it specified somewhere in the PHP
manual?
Thanks,
Nenad Jovanovic
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php