note 112012 added to language.oop5.basic
| From: | subramanya dot smg at gmail dot com | Date: | Mon, 22 Apr 2013 07:15:18 +0000 |
| Subject: | note 112012 added to language.oop5.basic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194591@lists.php.net to get a copy of this message | ||
PHP Classnames are case in-sensitive. Check the below code and the output.
$vars= "from vars";
$VARS = "From VARS";
echo $vars."<br>";
echo $VARS."<br>";
class aA {
function foo(){
if(isset($this))
{
echo "this class is defined(";
echo get_class($this);
echo ")<br>";
}
else echo "class not defined<br>";
}
}
class Bb{
function bar(){
aa::foo();
}
}
$classname = 'aa';
$a=new aa();
$a->foo();
$classname::foo();
$classname = 'bb';
$b = new bb();
$b->bar();
Bb::bar();
-------------
output:
from vars
From VARS
this class is defined(aA)
class not defined
this class is defined(Bb)
class not defined
this class is defined(Bb)
----
Server IP: 69.147.83.199
Probable Submitter: 27.251.237.74
----
Manual Page -- http://php.net/manual/en/language.oop5.basic.php
Edit -- https://master.php.net/note/edit/112012
Del: integrated -- https://master.php.net/note/delete/112012/integrated
Del: useless -- https://master.php.net/note/delete/112012/useless
Del: bad code -- https://master.php.net/note/delete/112012/bad+code
Del: spam -- https://master.php.net/note/delete/112012/spam
Del: non-english -- https://master.php.net/note/delete/112012/non-english
Del: in docs -- https://master.php.net/note/delete/112012/in+docs
Del: other reasons-- https://master.php.net/note/delete/112012
Reject -- https://master.php.net/note/reject/112012
Search -- https://master.php.net/manage/user-notes.php