PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I need to prohibit filenames with everything but English characters and numbers but regexp and string function don't seem to work because they consider the Greek alphabet letters as part of the A-Z a-z sequence. Here's what I've tried:
if (strspn($str, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") != strlen($str))
{
echo 'invalid filename';
}
if (!preg_match("/^([-a-z0-9])+$/i", $str))
{
echo 'invalid filename';
}
Are you absolutely sure that $str has Greek letters? I'm not talking about what you typed into an HTML form - I mean, have you looked closely at $str and verified it had Greek letters in it?