I keep getting the following error and I was wondering on how to fix?
Fatal error: Unsupported operand types in C:\\wamp\\www\\tuto\\core\\Controller.php on
+ can be used in different ways but to avoid complications, only use it on numeric values.
When you didnt initially set $this->vars to be an array, it won't work (thx to deceze);
see http://codepad.viper-7.com/A24zds
Instead try init the array and use array_merge:
public function set($key,$value=null){
if (!is_array($this->vars)) {
$this->vars = array();
}
if(is_array($key)){
$this->vars = array_merge($this->vars, $key);
}else{
$this->vars[$key] = $value;
}
}
Examples:
one'
print_r($test);
$test = array_merge($test, $t);
// will print both elements
print_r($test);