I have this code:
class foo
{
public function __construct
(
$bar[var1] = 0,
$bar[var2] = 0,
$bar[var3] = 0
)
{
/* do something */
}
}
and I get this error:
Parse error: syntax error, unexpected '[', expecting ')' in $this on line 5
and I have no idea about whats wrong.
EDIT:
I want to initialize the class like this: $instance = new foo($bar)
($bar is an array)
Because the class would expect many arguments, and I can easily return the array from the constructor. Let me know if this is not a good idea.