So I'm trying to create some sort of error messages, code looks like this:
function callError($errorcode, $attempts) {
$errormessage = array(
"0" => "Du har angivit fel lösenord, du har ". $attempts ." försök kvar. Kontrollera att du har skrivit rätt användarnamn.",
"1" => "Ditt konto har låsts, kontakta webmaster för att återställa det.",
"2" => "Användare finns inte, kontrollera att du har skrivit rätt användarnamn."
);
return $errormessage[$errorcode];
}
but when I run the first error message it doesn't work, it won't even show up. On the other hand when I run the other two it works flawless! I've tried to return an array containing $errormessage and $attempts but that doesn't work either.
What am I doing wrong here?
0 => array(), 1 => array() ...$errorcodeinto thecallError()function that isn't0,1or2or it fails to comply to the typecast from anintegerto astring. It's much better to use try-catch-throw mechanisms :)var_dump($errorcode).......