note 41305 deleted from function.is-a by nlopess
| From: | nlopess@php.net | Date: | Fri, 09 Apr 2004 14:30:32 +0000 |
| Subject: | note 41305 deleted from function.is-a by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67898@lists.php.net to get a copy of this message | ||
Note Submitter: manicdepressive@mindless.com
----
I suggest a small change to hendrix's code below, should someone decide to implement this
unusual pattern. Using isset() instead of is_a() will prevent a E_NOTICE from being generated, if
it is turned on. It is otherwise functionally equivalent.
<?php
class MyClass {
function method()
{
if (isset($this)) {
echo "static\n";
}
else {
echo "instance\n";
}
}
}
echo "<pre>";
MyClass::method();
$m = new MyClass();
$m->method();
?>
code till dawn,
mark meves