note 89560 added to language.oop5.basic
| From: | iacopo dot papalini at register dot it | Date: | Fri, 13 Mar 2009 15:31:20 +0000 |
| Subject: | note 89560 added to language.oop5.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151838@lists.php.net to get a copy of this message | ||
As a reply to the note of 'ialsoagree', a solution to his problem may be the following:
(for the lazy: just pass '$this' as a paremeter to the inner function)
<?php
class MyClass {
public $message = 'Hello';
public function MyClassFunction() {
function InnerFunction($theObject) {
echo $theObject->message; // Works fine
}
innerFunction($this);
}
}
$class = new MyClass;
$class->MyClassFunction();
?>
----
Server IP: 213.92.11.19
Probable Submitter: 195.110.97.5
----
Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php
Edit -- https://master.php.net/note/edit/89560
Del: integrated -- https://master.php.net/note/delete/89560/integrated
Del: useless -- https://master.php.net/note/delete/89560/useless
Del: bad code -- https://master.php.net/note/delete/89560/bad+code
Del: spam -- https://master.php.net/note/delete/89560/spam
Del: non-english -- https://master.php.net/note/delete/89560/non-english
Del: in docs -- https://master.php.net/note/delete/89560/in+docs
Del: other reasons-- https://master.php.net/note/delete/89560
Reject -- https://master.php.net/note/reject/89560
Search -- https://master.php.net/manage/user-notes.php