|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-01 11:51 UTC] helly@php.net
[2004-11-02 01:52 UTC] keith dot ward at gmail dot com
[2004-11-03 17:34 UTC] ashk06 at dsl dot pipex dot com
[2004-11-19 17:34 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
Description: ------------ When using extend to extend a class . Static variables are not inherited . Reproduce code: --------------- class a { public static $myvar; public function __construct() { $this->myvar = '1'; echo ' Set myvar to 1 ... ' . "\n"; var_dump($this); } } $a = new a(); class b extends a { function __construct() { echo 'DUmping from class b' . "\n"; var_dump($this); } } $a = new b(); ?> Expected result: ---------------- Set myvar to 1 ... object(a)#1 (1) { ["myvar"]=> string(1) "1" } Dumping from class b object(b)#2 (1) { ["myvar"]=> string(1) "1" } Actual result: -------------- Set myvar to 1 ... object(a)#1 (1) { ["myvar"]=> string(1) "1" } Dumping from class b object(b)#2 (0) { }