In PHP < 5.6 you can't have arrays as constants.
If you're looking to return a constant via a function, you'd simply do:
define('FOO', 'bar')
function getFoo() {
return FOO;
}
but that's not returning an array and it's quite a silly example.
I think what you're really looking to do is return an array from a class's static method, something like:
class Foo {
public static function GetFoo() {
return array(1, 2, 3);
}
}
Foo::GetFoo();
or if you want to run the function as a method of an object instance, you wouldn't set a static property (that doesn't make sense to me).
class Foo {
private $foo = array();
public function getFoo($arg1, $arg2) { // not sure what your arguments are for if this is intended to be a "constant"...
$this->foo = array(...)
return $this->foo
}
}
$someFoo = new Foo();
$someFoo->getFoo(1, 2);
Does this help at all? The numerous examples at PHP Constants Containing Arrays? should help, too.