The "syntax error unexpected ','" error is occurring here:
$foo1 = ($foo2, true);
Is the comma not suppose to be there?
You are either trying to create an array:
$foo1 = array($foo2, true);
Or calling a function:
$foo1 = myFunc($foo2, true);
Or trying to use a C comma expression, which PHP does not support (then again in that case $foo1
would just be assigned to true
).
include
, require
, echo
, print
, etc, which are all language constructs. Syntactically you can call them like functions, but they're not.This is not a valid php expression.
$foo =myfunc($foo2, true);
Will call the function myfunc with the parameters $foo2 and true. The result will then be assigned to $foo.
$foo = array($foo2, true);
Will create a new array with two elements($foo2 and true)
$foo = ($foo2, true);
Will just throw a parse error because the only valid symbols between to variables in this context are operators(+,-,%,AND,...).
foo($foo2, true);
, the function name being the difference. ;)