Page 1 of 1

What does "=&" do?

Posted: Fri Jul 30, 2004 4:36 pm
by pickle
Hi all,

Simple question: What does the "=&" operator do?

I'm working with the pear spreadsheet excel writer and an example uses:

Code: Select all

$xls =& new Spreadsheet_Excel_Writer('sheets/binary.xls');
Any ideas? Thanks.

Posted: Fri Jul 30, 2004 4:36 pm
by feyd
stores the reference to it.. instead of a copy.. it functions a LOT like a pointer in C..

Posted: Fri Jul 30, 2004 4:48 pm
by pickle
So, in effect, $xls will just passthrough anything done to it, onto what it references.

So:

Code: Select all

$my_object = new FunkyObject();
$new_object =& $my_object;
$new_object->funky_var = "7";
echo $my_object->funky_var;
would echo "7" right?

Posted: Fri Jul 30, 2004 5:09 pm
by feyd
yep

Posted: Fri Jul 30, 2004 5:13 pm
by pickle
Cool, thanks.