note 97702 added to language.references.arent
| From: | russrobinson at tectite dot com | Date: | Tue, 04 May 2010 03:17:13 +0000 |
| Subject: | note 97702 added to language.references.arent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168902@lists.php.net to get a copy of this message | ||
In my previous post I said:
"It is my view that object references in PHP5 are exactly like pointers in C++."
"exactly like" is misleading...
To clarify:
I don't mean PHP5 object references support pointer arithmetic or they contain memory
addresses.
I mean that, in PHP5, when you pass object variables to functions they *behave* exactly like
pointers to objects do in the same situation when writing in C++ (with the exception of the C++
features that just don't exist in PHP, such as pointer arithmetic).
Namely,
1. When you pass the object variable, the formal parameter behaves like a C++ pointer to the object
inside the function.
2. When you pass the object variable by reference, the formal parameter behaves like a C++ reference
to a pointer to the object inside the function.
The syntax is different between the languages, but the semantics are identical.
----
Server IP: 117.55.229.1
Probable Submitter: 121.214.163.250
----
Manual Page -- http://www.php.net/manual/en/language.references.arent.php
Edit -- https://master.php.net/note/edit/97702
Del: integrated -- https://master.php.net/note/delete/97702/integrated
Del: useless -- https://master.php.net/note/delete/97702/useless
Del: bad code -- https://master.php.net/note/delete/97702/bad+code
Del: spam -- https://master.php.net/note/delete/97702/spam
Del: non-english -- https://master.php.net/note/delete/97702/non-english
Del: in docs -- https://master.php.net/note/delete/97702/in+docs
Del: other reasons-- https://master.php.net/note/delete/97702
Reject -- https://master.php.net/note/reject/97702
Search -- https://master.php.net/manage/user-notes.php