You are here: Re: [PHP] check for alphanumeric characters « PHP « IT news, forums, messages
Re: [PHP] check for alphanumeric characters

Posted by Philip Hallstrom on 04/29/05 19:08

> what kind of a function can I use that will tell me whether a variable is
> alphanumeric (that is has only characters A-Z or 1-9 )?

http://us3.php.net/manual/en/function.ctype-alnum.php

bool ctype_alnum ( string text )

Checks if all of the characters in the provided string, text, are
alphanumeric. In the standard C locale letters are just [A-Za-z] and the
function is equivalent to preg_match('/^[a-z0-9]*$/i', $text).

Returns TRUE if every character in text is either a letter or a digit,
FALSE otherwise.

----

Note that if you pass in an empty string you'll also get TRUE...

-philip

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация