note 88763 added to language.oop5.basic
| From: | Arpit at osu1 dot php dot net | Date: | Fri, 06 Feb 2009 14:14:20 +0000 |
| Subject: | note 88763 added to language.oop5.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150297@lists.php.net to get a copy of this message | ||
//try this code if you define a new class inside an object method than we can refer to
"$class->message"
//unset this instance doesn't affected the previous one
//it will not report a fatal error
<?php
class MyClass {
public $message = 'Hello';
public function MyClassFunction() {
function InnerFunction() {
$class = new MyClass;
print_r($class);
echo $class->message;
unset($class);//unset this doesn't affected the previous one or we can also use different
name $classNew=new MyClass;
}
innerFunction();
}
}
$class = new MyClass;
$class->MyClassFunction();
?>
----
Server IP: 59.162.86.33
Probable Submitter: 220.227.154.153
----
Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php
Edit -- https://master.php.net/note/edit/88763
Del: integrated -- https://master.php.net/note/delete/88763/integrated
Del: useless -- https://master.php.net/note/delete/88763/useless
Del: bad code -- https://master.php.net/note/delete/88763/bad+code
Del: spam -- https://master.php.net/note/delete/88763/spam
Del: non-english -- https://master.php.net/note/delete/88763/non-english
Del: in docs -- https://master.php.net/note/delete/88763/in+docs
Del: other reasons-- https://master.php.net/note/delete/88763
Reject -- https://master.php.net/note/reject/88763
Search -- https://master.php.net/manage/user-notes.php