The PHP function below is producing this error: Parse error: syntax error, unexpected ‘(‘, expecting T_STRING or T_VARIABLE or ‘$’, on this line: throw new ( '' . 'Illigal name for service name "' . $name . '" is given' );
Does anyone know what’s wrong?
function registerService($name, $provider) {
if (strlen( $name ) < 1) {
Exception;
throw new ( '' . 'Illigal name for service name "' . $name . '" is given' );
}
$this->_Services[$name] = $provider;
}
Thanks
Change this:
To this:
Also, normally you’d throw an Exception in a try catch block: