since dom xml is a php4 extension, i presuppose that you are using php4 ?
php4 per default assigns by value, not by reference. while this is fine for scalar types, it certainly acts counter-intuitive in regards to objects.
as a general rule of thumb, you should allways assign by reference, when dealing with objects. eg :
PHP Code:
function takeByRef(&$someObject) {
}
// and
$someObject =& new MyObject();
functions that retun objects, should also do so by reference, eg :
PHP Code:
function & gimmeAnObject() {
return new MyObject();
}
$someObject =& gimmeAnObject();
check the php manual for more explanation on references :
http://www.php.net/references
Bookmarks