PHP: Extending static member arrays
Posted
by tstenner
on Stack Overflow
See other posts from Stack Overflow
or by tstenner
Published on 2010-05-23T18:28:03Z
Indexed on
2010/05/23
18:30 UTC
Read the original article
Hit count: 263
I'm having the following scenario:
class A { public static $arr=array(1,2); }
class B extends A { public static $arr=array(3,4); }
Is there any way to combine these 2 arrays so B::$arr
is 1,2,3,4
?
I don't need to alter these arrays, but I can't declare them als const, as PHP doesn't allow const arrays.http://stackoverflow.com/questions/ask
The PHP manual states, that I can only assign strings and constants, so parent::$arr + array(1,2)
won't work, but I think it should be possible to do this.
© Stack Overflow or respective owner