Possible Duplicate:
How to get name of calling function/method in PHP?
So in PHP I'm trying to build a custom error handler class. It's pretty simple: I give it a code number and it gives back a formatted error message which I can use to send to mobile devices.
So it looks like this now:
class Errorhandler {
private $errors = array(
//here be error codes and messages
100 => 'Missing input or parameter!'
);
public function __construct($code = 100){
//return formatted output
}
}
So I'd use the class above like:
public function someFunction(){
//some conditions met, then throw an error
$handler = new ErrorHandler();
$this->response = $handler;
}
So I'd need the parent function's name (someFunction) in my Errorhandler class so I can return it with the formatted error message. On a side note: I don't want to use parameters for this, too much writing there.