Ok, this is the basic idea I thought of (not really, I saw it in some other scripting a while back). The idea is to have error messages stored in a file or another part of a script. Each error will have its own id (so to speak). I dont remember if the errors were stored in a class, function, or whatever, but when an error occured in a certain script, it would call to that function (or whatever it was), and then it would dynamiclly get the error message.
Something like this:
$num = "2";
if($num = 4)
{
do something here //actual php code would be here
}elseif($num != 4)
{
call error 101 //actual php code would be here
}