I'm having a problem, and I wrote this sample code to illistrate it.
In this code, I'm trying to create a object, put it throught a que. I
then want something to happen to this object, and this change to be
reflected in the original object. I am aware that PHP uses copy
symantecs not refrence ones, so I have used "&" at all the places I can
see to use them. However it doesnt work: the output from this is still
0 not 100 as it should be.
Does anyone have any suggestions, or URL's to really good guides on
reference passing?
Thanks in Advance,
James.
---------------------
class test {
var $flag = 0;
}
// Make Object
$root = new test();
// Make Que
$que = array();
// Stick object on que
array_push($que, &$root);
// Take object from Que
$consider =& array_shift($que);
// Change something on the object we pulled from the que
$consider->flag = 100;
// Test and see if it changed on the original object
echo($root->flag);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php