note 75894 added to language.constants.predefined
| From: | php at kennel17 dot co dot uk | Date: | Wed, 20 Jun 2007 17:29:33 +0000 |
| Subject: | note 75894 added to language.constants.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127834@lists.php.net to get a copy of this message | ||
Further to my previous note, the 'object' element of the array can be used to get the
parent object. So changing the get_class_static() function to the following will make the code
behave as expected:
<?php
function get_class_static() {
$bt = debug_backtrace();
if (isset($bt[1]['object']))
return get_class($bt[1]['object']);
else
return $bt[1]['class'];
}
?>
HOWEVER, it still fails when being called statically. Changing the last two lines of my previous
example to
<?php
foo::printClassName();
bar::printClassName();
?>
...still gives the same problematic result in PHP5, but in this case the 'object' property
is not set, so that technique is unavailable.
----
Server IP: 69.147.83.197
Probable Submitter: 85.210.211.75
----
Manual Page -- http://www.php.net/manual/en/language.constants.predefined.php
Edit -- https://master.php.net/note/edit/75894
Del: integrated -- https://master.php.net/note/delete/75894/integrated
Del: useless -- https://master.php.net/note/delete/75894/useless
Del: bad code -- https://master.php.net/note/delete/75894/bad+code
Del: spam -- https://master.php.net/note/delete/75894/spam
Del: non-english -- https://master.php.net/note/delete/75894/non-english
Del: in docs -- https://master.php.net/note/delete/75894/in+docs
Del: other reasons-- https://master.php.net/note/delete/75894
Reject -- https://master.php.net/note/reject/75894
Search -- https://master.php.net/manage/user-notes.php