note 89356 added to function.get-called-class
| From: | progman at centrum dot sk | Date: | Wed, 04 Mar 2009 15:19:55 +0000 |
| Subject: | note 89356 added to function.get-called-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151458@lists.php.net to get a copy of this message | ||
if (!function_exists('get_called_class')):
function get_called_class()
{
$bt = debug_backtrace();
if (isset($bt[1]['file']) && isset($bt[1]['line']) &&
isset($bt[1]['function']))
{
$lines = file($bt[1]['file']);
$pattern = '/([a-zA-Z0-9\_]+)::'.$bt[1]['function'].'/';
preg_match($pattern, $lines[$bt[1]['line']-1], $matches);
if (count($matches)>0)
return $matches[0];
}
return false;
}
endif;
----
Server IP: 217.73.17.12
Probable Submitter: 213.160.186.25
----
Manual Page -- http://www.php.net/manual/en/function.get-called-class.php
Edit -- https://master.php.net/note/edit/89356
Del: integrated -- https://master.php.net/note/delete/89356/integrated
Del: useless -- https://master.php.net/note/delete/89356/useless
Del: bad code -- https://master.php.net/note/delete/89356/bad+code
Del: spam -- https://master.php.net/note/delete/89356/spam
Del: non-english -- https://master.php.net/note/delete/89356/non-english
Del: in docs -- https://master.php.net/note/delete/89356/in+docs
Del: other reasons-- https://master.php.net/note/delete/89356
Reject -- https://master.php.net/note/reject/89356
Search -- https://master.php.net/manage/user-notes.php