You can only assign constant values in this context. You will need to initialize $fooin the constructor if you want to use the return value of the function.
<?php
class What {
public $foo;
public function __construct() {
$this->foo = range(0,5);
}
}
?>
BTW: As others have noted, is array()not a function. This is a language construct.
source
share