note 89356 deleted from function.get-called-class by danbrown

From: Date: Wed, 22 Apr 2009 12:48:32 +0000
Subject: note 89356 deleted from function.get-called-class by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153580@lists.php.net to get a copy of this message
Note Submitter: progman at centrum dot sk ---- <?php 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; ?>

« previous php.notes (#153580) next »