PHP Classes

The utility of this class is insufficient.

Recommend this page to a friend!

      Invalid Characters  >  All threads  >  The utility of this class is...  >  (Un) Subscribe thread alerts  
Subject:The utility of this class is...
Summary:Package rating comment
Messages:1
Author:Artur Graniszewski
Date:2010-08-24 06:22:30
 

Artur Graniszewski rated this package as follows:

Utility: Insufficient
Consistency: Sufficient
Examples: Sufficient

  1. The utility of this class is...   Reply   Report abuse  
Picture of Artur Graniszewski Artur Graniszewski - 2010-08-24 06:22:30
The utility of this class is insufficient.

1) The list of allowed characters is hardcoded. This is a problem for
non-english charset encodings like ISO-8859-2 or UTF-8

2) The validation alghoritm is very inefficient:
a) strlen(..) used every loop iteration (slows down entire code)
b) there is a much faster (and needs much less coding) one liner solution:
preg_match('~^[a-z0-9]$~i, $string),

or even better (faster):

ctype_alnum($string)