What does "=&" do?

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

Post Reply
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

What does "=&" do?

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

stores the reference to it.. instead of a copy.. it functions a LOT like a pointer in C..
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yep
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Cool, thanks.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply