PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Fri Jul 30, 2004 4:36 pm
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Jul 30, 2004 4:36 pm
stores the reference to it.. instead of a copy.. it functions a LOT like a pointer in C..
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Fri Jul 30, 2004 4:48 pm
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?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Jul 30, 2004 5:09 pm
yep
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Fri Jul 30, 2004 5:13 pm
Cool, thanks.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.