|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-05 14:32 UTC] tony2001@php.net
[2006-10-05 14:56 UTC] matti at nitro dot fi
[2006-10-05 15:04 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 22:00:01 2025 UTC |
Description: ------------ self:: doesn't care for inheritance in instantiated classes. self:: doesn't care for private. private & static keywords don't work together. redeclaration of static variables doesn't work even for private static. Reproduce code: --------------- <?php class A { static $a = 1; function show() { echo self::$a; } } class B extends A { static $a = 2; } B::show(); // writes "1" not "2" $b = new B(); $b->show(); // writes "1" not "2" print '<hr />'; class C { private static $a = 1; function show() { echo self::$a; } } class D extends C { private static $a = 2; } D::show(); // writes "1" not "2" $d = new D(); $d->show(); // writes "1" not "2" ?> Expected result: ---------------- 22<hr />22 Actual result: -------------- 11<hr />11