note 129210 added to language.oop5.basic
| From: | gazianis2200 at gmail dot com | Date: | Wed, 31 Jan 2024 06:21:00 +0000 |
| Subject: | note 129210 added to language.oop5.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221164@lists.php.net to get a copy of this message | ||
<?php
/**
$this is availabe within a method when a method is called from within a object context.$this is the
value of the calling object
*/
class SimpleClass {
public $a = "Default Value";
public function DisplayVar(){
echo $this->a;//Default Value
echo "\n";
echo (new SimpleClass)->a;//Default Value
echo "\n";
echo get_class($this);//SimpleClass
echo "\n";
echo get_class(new SimpleClass);//SimpleClass
}
}
$obj = new SimpleClass;
$obj->DisplayVar();
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 103.120.33.26)
----
Manual Page -- https://php.net/manual/en/language.oop5.basic.php
Edit -- https://main.php.net/note/edit/129210
Del: integrated -- https://main.php.net/note/delete/129210/integrated
Del: useless -- https://main.php.net/note/delete/129210/useless
Del: bad code -- https://main.php.net/note/delete/129210/bad+code
Del: spam -- https://main.php.net/note/delete/129210/spam
Del: non-english -- https://main.php.net/note/delete/129210/non-english
Del: in docs -- https://main.php.net/note/delete/129210/in+docs
Del: other reasons-- https://main.php.net/note/delete/129210
Reject -- https://main.php.net/note/reject/129210
Search -- https://main.php.net/manage/user-notes.php