|
Posted by Jason Barnett on 01/21/05 19:22
Marek wrote:
> Hello
>
> I'm trying to create a public static array within a class.(PHP5).
>
> First - the following fails:
>
> class yadayada {
> public static $tester[0]="something";
> public static $tester[1]="something 1";
>
> Second - However the following works:
>
> class yadayada {
> public static $tester = array (0 => "something", 1 >="something 1");
Since we are talking about a static variable then I think your only
option is this. I assume you want only one $tester array for this
entire class, correct?
Visually another way of laying this out that looks less messy:
class yadayada {
public static $tester = array (
0 => "something",
1 => "something else",
2 => "...",
150 => "Finally done!"
);
}
>
> My question is this: I have an array that has about some 150 different values and using the second example would get very very messy, is there another method of doing this ? The first example(which fails) is the cleanest, is there anything I can do ?
>
> Thank you
>
>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
Navigation:
[Reply to this message]
|