note 69144 added to language.references.whatdo
| From: | randallgirard at hotmail dot com | Date: | Thu, 24 Aug 2006 16:54:28 +0000 |
| Subject: | note 69144 added to language.references.whatdo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116273@lists.php.net to get a copy of this message | ||
After countless hours of debugging, headaches, and research... It finally hit me what was wrong with
a class I was writing.
Take the following code for example:
class foo {
function foo() {
$bar = new bar();
$this->bar =& $bar; # Reference
}
}
class bar { }
$foobar = new foo();
I soon realised, that objects which I created in the first routine were being copied... As what
I'm designing has an Object Tree structure, and variables were missing later at runtime.
Anywho, perhaps I was missing a reference somewhere or something but all the code looked correct!!
Then rereading the References documentation on php.net, I realised that php4's 'new'
routine does not pass as reference, yet php5 does and it is deprecated hence it prints an E_STRICT
error. I havn't used php5 myself yet, but wow how irritating... It should have passed by
reference long ago, or well documented that creating objects should be done with references.
I still and will always say, Perl is and will always be much > PHP
----
Server IP: 216.194.113.175
Probable Submitter: 70.36.165.124
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.references.whatdo.php
Edit -- https://master.php.net/note/edit/69144
Del: integrated -- https://master.php.net/note/delete/69144/integrated
Del: useless -- https://master.php.net/note/delete/69144/useless
Del: bad code -- https://master.php.net/note/delete/69144/bad+code
Del: spam -- https://master.php.net/note/delete/69144/spam
Del: non-english -- https://master.php.net/note/delete/69144/non-english
Del: in docs -- https://master.php.net/note/delete/69144/in+docs
Del: other reasons-- https://master.php.net/note/delete/69144
Reject -- https://master.php.net/note/reject/69144
Search -- https://master.php.net/manage/user-notes.php