# $ref =& $this;

- Thread: https://externals.io/message/19392
- Original archive: https://news-web.php.net/php.internals/19392
- Started by Ford on 2005-10-04T13:17:23+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #19392 — Ford — 2005-10-04T13:17:23+00:00

URL: https://externals.io/message/19392#19392

> Amazing how fast the assumption has become that passing
> object values in
> PHP5 is identical to passing the object by reference. It is not the
> same, there are subtle differences. Either way I'm not weighing in on
> the $ref = &$this issue, only that $obj = $someObj is NOT the same as
> $obj = &$someObj. 

Yes, very true.  I've mentioned before that I think PHP 5's object thingummies should be referred to as "handles" (and I'm sure I actually saw this usage in early versions of the PHP 5 or Zend Engine 2 proposals).  Then, it's much clearer that:

   $obj2 = $obj1

gives you a copy of the object handle, but:

   $obj2 = &$obj1

gives you a reference to the handle.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

---

## #19398 — oliver.graetz@arcor.de — 2005-10-04T14:30:40+00:00

URL: https://externals.io/message/19392#19398 · In reply to: #19392

Ford, Mike schrieb:
> Yes, very true.  I've mentioned before that I think PHP 5's object thingummies should be referred to as "handles" (and I'm sure I actually saw this usage in early versions of the PHP 5 or Zend Engine 2 proposals).  Then, it's much clearer that:
> 
>    $obj2 = $obj1
> 
> gives you a copy of the object handle, but:
> 
>    $obj2 = &$obj1
> 
> gives you a reference to the handle.

From the point of view of an ordinary programmer: He's so right: It is
absolutely clear! You _must_ put this in the official documentation!
I knew what was happening before but up to this few words I could not
put it down in words. Thank you, Mike!

AllOLLi

____________
Simon: "So what are we doing?"
Kaylee: "Oh! Crime."
Simon: "Crime, good. Okay. Crime."
[firefly 02]
