Quantcast
Channel: How to initialize static variables - Stack Overflow
Viewing all articles
Browse latest Browse all 11

How to initialize static variables

$
0
0

I have this code:

private static $dates = array('start' => mktime( 0,  0,  0,  7, 30, 2009),  // Start date'end'   => mktime( 0,  0,  0,  8,  2, 2009),  // End date'close' => mktime(23, 59, 59,  7, 20, 2009),  // Date when registration closes'early' => mktime( 0,  0,  0,  3, 19, 2009),  // Date when early bird discount ends);

Which gives me the following error:

Parse error: syntax error, unexpected '(', expecting ')' in /home/user/Sites/site/registration/inc/registration.class.inc on line 19

So, I guess I am doing something wrong... but how can I do this if not like that? If I change the mktime stuff with regular strings, it works. So I know that I can do it sort of like that..

Anyone have some pointers?


Viewing all articles
Browse latest Browse all 11

Trending Articles