Check valid chars in string

From: Date: Mon, 02 Dec 2002 15:09:16 +0000
Subject: Check valid chars in string
Groups: php.general 
Request: Send a blank email to php-general+get-126720@lists.php.net to get a copy of this message
function valid_chars($file_name) { for($i = 0; $i < strlen($file_name); $i++) {   if (!in_array($file_name[$i], array('q','w','e','r','t','y','u','i','o','p','l','k','j','h', 'g','f','d','s','a','z','x','c','v','b','n','m','Q','W', 'E','R','T','Y','U','I','O','P','L','K','J','H','G','F', 'D','S','A','Z','X','C','V','B','N','M','0','1','2','3', '4','5','6','7','8','9', '.', '_'))) {  return false; } else {  return true;   } } Found this snippet of code on php.net (http://www.php.net/manual/sk/ref.strings.php), but it just reurns a parse error. OS: OS X 10.2 PHP: PHP 4.2.3 MYSQL: 3.23.51 // magnus n.

« previous php.general (#126720) next »