lundi 12 janvier 2015

PHP Error when returning value into new array


Vote count:

-2




I want to build a new array using values returned from a static method from another class, like so:



class Foo {
public static $vars = array(
'foo' => Config::method('returns a string'), /* line where error occurs */
'bar' => Config::anothermethod('another string')
);
}


Now PHP throws this error:


Parse error: syntax error, unexpected '(', expecting ')' in file.php on line 22


The method simply returns a string, which I double checked. I even tried stringifying it with (string) Config::method('foo') , no success. Is this not possible?



asked 2 mins ago







PHP Error when returning value into new array

Aucun commentaire:

Enregistrer un commentaire