I have a class that uses __call():
public function __call($method, $args){
$method = "_".$method;
if (method_exists($this, $method)) {
try {
return $this->$method($args);
}
catch (Validation_exception $e) {
$this->exceptions[] = $e->getMessage();
return;
}
}
}
But that will return me an array even if I have a method that returns a string:
protected function _return_string(){
return "string";
}
So if I do:
echo $myclass->return_string();
print_r( $myclass->return_string() );
It will output:
Array()
Array([0] => “string”)
Why does it return an array??
// output on screen “Hello World”
Note: return $this->$method($args) passed $args as an array.