Posted by Toby A Inkster on 03/02/07 17:56
Iván Sánchez Ortega wrote:
> You're assigning a copy og $item to $toc_items_arr[1], not a reference to
> $item.
This is almost certainly the problem.
Note that in PHP 5 the default behaviour of the assignment operator is
changed with respect to how it operates on objects, and is closer to the
Java behaviour which is what I think you were expecting.
PHP 4:
<?php
$a = new Object();
$b = $a;
// Variables $a and $b point to two different objects.
// Changes to $a do not effect $b.
?>
PHP 5:
<?php
$a = new Object();
$b = $a;
// Variables $a and $b point to the same object.
// Changes to $a effect $b.
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|