Can someone please explain me why the following doesn't work, or give me a link which explains why? I can't find it here or on google.
This works:
var_dump( array( 'test' => rand(1,5) ) );
This does not:
$myClass = new myClass();
var_dump($myClass->array);
class myClass {
public $array = array( 'test' => rand(1,5) );
}
It doesn't like the function call in the array:
Parse error: syntax error, unexpected '(', expecting ')'
I guess it is my lack of understanding. If someone could help me to understand it, this would be nice.
Thanks!