A PHP problem that tends to sneak by is the handling of strtolower and encoding. For a while now I have worked on a project that is partially on a Windows-server, with limited control for us. Sometimes there is trouble when you make comparison of textstrings and want to use strtolower. Since “Mattias” and “mattias” is not the same thing you want to make both strings lowercse. But strtolower() don’t want to play with for example swedish chars "å,ä,ö" in UTF-8.
A solution to this problem can be to change the chars to something else, why not htmlentities(). You can for example to this to change the value to lowercase and get around encoding problem:
1 2 3 | $value = htmlentities($value, ENT_COMPAT, 'UTF-8'); $value = trim(strtolower($value)); $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8'); |
Another solutions is to use mb_strtolower() if that function is available (which it isn't on the Windows server in question).


