note 123493 added to language.oop5.basic
| From: | Anonymous@php.net | Date: | Sat, 05 Jan 2019 10:45:32 +0000 |
| Subject: | note 123493 added to language.oop5.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209998@lists.php.net to get a copy of this message | ||
Note that $this cannot be reassigned, because most instance functions would not work. So this code
throws a fatal error :
<?php
class Foo {
function reassign() {
// This line triggers an E_ERROR
$this = new Foo();
}
}
$example = new Foo();
$example->reassign();
?>
----
Server IP: 208.43.231.9
Probable Submitter: 2a02:cb43:e::301 (proxied: 2a01:e35:243a:dc10:d8ac:8f2e:6361:8dd3)
----
Manual Page -- http://php.net/manual/en/language.oop5.basic.php
Edit -- https://master.php.net/note/edit/123493
Del: integrated -- https://master.php.net/note/delete/123493/integrated
Del: useless -- https://master.php.net/note/delete/123493/useless
Del: bad code -- https://master.php.net/note/delete/123493/bad+code
Del: spam -- https://master.php.net/note/delete/123493/spam
Del: non-english -- https://master.php.net/note/delete/123493/non-english
Del: in docs -- https://master.php.net/note/delete/123493/in+docs
Del: other reasons-- https://master.php.net/note/delete/123493
Reject -- https://master.php.net/note/reject/123493
Search -- https://master.php.net/manage/user-notes.php