Object Code Syntax Question

1 view
Skip to first unread message

John

unread,
Apr 17, 2008, 5:27:26 AM4/17/08
to Php Object Generator
In my first attempt with PHP objects I set up an Album and a Image
Class. I defined image as a "Child" attribute of the Album Class and
Album as a "Parent" of the image class.

In examining the generated code for Album, I noted passed function
variables with an "&" prefix such as:

function SetImageList(&$list)
{
.............
}

I could only find one description of this on line and it referred to
variables passed by name rather than being copied and alterations made
to the original source.

Is there a link to a reference that describes this more fully?

Thanks .... John

andy law (RI)

unread,
Apr 17, 2008, 3:51:40 PM4/17/08
to Php-Object...@googlegroups.com
John,

Welcome to the wonderful world of references, copies and clones in php.

Your email has chivvied me into action and I've tried to describe what
is going on, partly for my own reference in the future as this has
bitten me recently with a project I've been working on. See
http://sportsdaft.blogspot.com/2008/04/by-reference-vs-by-value-in-php.h
tml for some detail. I reserve the right to be completely wrong though
so check anything I say out before taking it as fact.

This guy (http://mjtsai.com/blog/2004/07/15/php-5-object-references/)
also provides some good info and the discussion at the foot of his blog
entry has some interesting and useful comments.

Later,

Andy

-------------
Yada, yada, yada...

Roslin Institute is a company limited by guarantee, registered in
Scotland (registered number SC157100) and a Scottish Charity (registered
number SC023592). Our registered office is at Roslin, Midlothian, EH25
9PS. VAT registration number 847380013.

The information contained in this e-mail (including any attachments) is
confidential and is intended for the use of the addressee only. The
opinions expressed within this e-mail (including any attachments) are
the opinions of the sender and do not necessarily constitute those of
Roslin Institute (Edinburgh) ("the Institute") unless specifically
stated by a sender who is duly authorised to do so on behalf of the
Institute.

Reply all
Reply to author
Forward
0 new messages