note 57269 deleted from migration5.oop by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Aug 2008 02:41:14 +0000 |
| Subject: | note 57269 deleted from migration5.oop by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143081@lists.php.net to get a copy of this message | ||
Note Submitter: riseofthethorax at yahooo dot com
----
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