Form Input Validation Technique in PHP

I am sure you have written form's input field validation code using your server side scripts. Form validation is most common code we have to write. We generally validate our form for name, age, sex, phone, email and others. For these fields, if we get little complex validation we start to seek regular expression (regex).
Regular expression is good tool for validating data but it is very complex and so error prone. Very few programmers know regex.

Just a year back I got a new idea for validating form fields.
Suppose your form input 'name' field would accept all alpha characters with some special characters. Special characters here are: ' ' (space), '’', & and -.

Instead of writing regular expression for this, I have written code like this:

<?php
$nAccept = array("&", "’", " ",  "-");
if (! Ctype_alpha(str_replace ($nAccept, "", $name))) {
 // Error in this name field
 // do something
}
?>

ctype_* is very good functions provided in PHP. It is for you for using in validation.