note 86327 deleted from function.get-class by tularis
| From: | tularis@php.net | Date: | Mon, 13 Oct 2008 13:30:22 +0000 |
| Subject: | note 86327 deleted from function.get-class by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145314@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
Reason: useless
----
I really needed to use get_called_class in a particular project, but my local dev environment is
stuck on PHP 5.2.6 due to being reliant on Wamp.
This isn't an issue for the live server so I added this temporary hack. I'm not proud of
it but it does the job and will do me until I can upgrade Wamp or have more time to do a proper
install on my work machine. Will take it out as soon as I can.
<?php
if(function_exists('get_called_class')){
$class = get_called_class();
}else{
$trace = debug_backtrace();
$class = $trace[1]['class'];
}
?>
Sorry. ;)