note 57269 added to migration5.oop
| From: | riseofthethorax at yahooo dot com | Date: | Thu, 29 Sep 2005 01:53:22 +0000 |
| Subject: | note 57269 added to migration5.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95947@lists.php.net to get a copy of this message | ||
I actually understand the addressing modes in 4.3 and use them, it hasn't bothered me.. Like I
have objects within objects, each with variables containing references (like pointers but without
the pointer arithmetic). I can obtain an object group from the database, obtain the method
interface to a subobject, issue a manipulation through the child, then store the object group back
into the database with the manipulation intact.. I'm not sure what effect the new changes will
have on this, but if its drastic, I'm not sure I can support 5.0.
A nice little userlevel way of messing with PHP's addressing,
the use of aliases:
// I haven't coded in PHP for a while so sue me
class stuff {
var $stuff;
function stuffer() {
$null = NULL;
$s = &$this->stuff;
$s = "some stuff";
$s = &$null;
}
}
This works.. You can make some assumptions about
what is going on behind the scenes, especially
what $s is before being assigned a reference to
another variable and after.. Its either two kinds of things,
a reference to a variable or a container of data, or
its a reference to a data location at all times, just that by default it gets an address to a string
and at other times it can be assigned the address of objects. The "&" redirects where
its pointing. At least this is how I think about it.
I use this side-effect all the time for making aliases in my objects..
Kiernan
----
Manual Page -- http://www.php.net/manual/en/migration5.oop.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57269
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57269&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57269&report=yes
Search -- http://master.php.net/manage/user-notes.php