If your API constains error description messages, what is the best design(A or B??)
$code = array(
'100'=>'message in english here',
'110'=>'message in english here');
//OPTION A
include 'error_in_{$lan}.php'; //$lan is 'es','en', etc..
$error = class->function(xxx);
echo $codes[$error];
//OPTION B
$error = class->function(xxx);
$error->getDescription($lan);
Best way to handle error descriptions
Moderator: General Moderators
Re: Best way to handle error descriptions
If I understand correctly I think it would depend on how big that array of error codes gets. If it's a large array you certainly don't want to be declaring it upon every page load, that would just waste memory and processing power. Thus, including an error file would probably be the best thing. It also allows for easier abstraction.