note 56588 added to language.oop5.paamayim-nekudotayim
| From: | civilization_2 at hotmail dot com | Date: | Thu, 08 Sep 2005 09:40:52 +0000 |
| Subject: | note 56588 added to language.oop5.paamayim-nekudotayim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94901@lists.php.net to get a copy of this message | ||
A small note/question regarding migration from php4 to php5 ...
Take for example this piece of code:
<?
class Test1 {
public function f1() {
print_r(debug_backtrace());
}
}
class Test2 extends Test1 {
}
Test1::f1();
Test2::f1();
?>
Under php4 the result is:
<?
Array
(
[0] => Array
(
[file] => test.php
[line] => 11
[function] => f1
[class] => test1
[type] => ::
[args] => Array
(
)
)
)
Array
(
[0] => Array
(
[file] => test.php
[line] => 12
[function] => f1
[class] => test2
[type] => ::
[args] => Array
(
)
)
)
?>
Under php5 the result is:
<?
Array
(
[0] => Array
(
[file] => test.php
[line] => 11
[function] => f1
[class] => Test1
[type] => ::
[args] => Array
(
)
)
)
Array
(
[0] => Array
(
[file] => test.php
[line] => 12
[function] => f1
[class] => Test1
[type] => ::
[args] => Array
(
)
)
)
?>
I know the class names are now case-sensitive ... but under php5 The class name in the second
function call has now changed from the class called (Test2) to the class containing the function
(Test1)!
Is this a bug or the new way that php5 just works?
If this is by design, then does anyone know how I can get the name of the class called?
Thanks.
----
Manual Page -- http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56588
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56588&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56588&report=yes
Search -- http://master.php.net/manage/user-notes.php