note 87053 added to language.operators.type
| From: | jtaal at eljakim dot nl | Date: | Mon, 17 Nov 2008 13:37:39 +0000 |
| Subject: | note 87053 added to language.operators.type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146621@lists.php.net to get a copy of this message | ||
You can use "self" to reference to the current class:
<?php
class myclass {
function mymethod($otherObject) {
if ($otherObject instanceof self) {
$otherObject->mymethod(null);
}
return 'works!';
}
}
$a = new myclass();
print $a->mymethod($a);
----
Server IP: 83.137.20.135
Probable Submitter: 80.100.178.156
----
Manual Page -- http://www.php.net/manual/en/language.operators.type.php
Edit -- https://master.php.net/note/edit/87053
Del: integrated -- https://master.php.net/note/delete/87053/integrated
Del: useless -- https://master.php.net/note/delete/87053/useless
Del: bad code -- https://master.php.net/note/delete/87053/bad+code
Del: spam -- https://master.php.net/note/delete/87053/spam
Del: non-english -- https://master.php.net/note/delete/87053/non-english
Del: in docs -- https://master.php.net/note/delete/87053/in+docs
Del: other reasons-- https://master.php.net/note/delete/87053
Reject -- https://master.php.net/note/reject/87053
Search -- https://master.php.net/manage/user-notes.php