check if string contains specific characters
Posted: Sat Dec 03, 2011 9:49 pm
I have this function in a log script:
It does what it's told to do, perfectly, BUT the æøå,ÆØÅ,å etc. chars. Those it just ignores 
Otherwise it works perfectly fine.
What is it about the æøå signs? As you can see, I've tried in some different ways.
Code: Select all
function ctype($l) { //Returns TRUE if link only contains valid signs.
$nl = $l; //yes, this is "L"'s
$keys = array("æ","ø","å","Æ","Ø","Å","å","ø","Æ","æ","Ø","Å","@", "£", "¤", "%", "&", "/", "\\", "^", "*", "§", "½", ".", ",", ":", ";", "'", "¨", "~", "[", "]", "{", "}", "´", "`", "@", "!", '"', "'"," ");
$array = array_fill_keys($keys, "-");
$nl = strtr($l,$array);
if ($nl != $l)
return false;
else return true;
}Otherwise it works perfectly fine.
What is it about the æøå signs? As you can see, I've tried in some different ways.