I've built a class file which has a function inside containing various errors. I want to move that function to a config.php file.
How do I carry on using that function now it's inside config.php?
The function:
private function error($errnum=1000) {
$data = array(
'1000' => 'Required parameter is missing',
'1100' => 'Parameter not recognized',
'2000' => 'Currency type not recognized',
'2100' => 'Currency amount must be to 2 decimal places',
'2200' => 'Currencies cannot be the same',
'3000' => 'Service currently unavailable',
'3100' => 'Error in service'
);
$this->result($data[$errnum], $errnum);
}
I tried using:
require_once("config/config.php");
in the class file but it still shows an error
Parse error: syntax error, unexpected T_PRIVATE
erroris a slightly too generic/ ambiguous name, for a function anyway.