The Validation class is a stand-alone library, which in terms means that it does not actually requires any other to function. The usage of this class is to validate data.
We are validating a string to with the Validation::is_alnum method, to ensure that the data only consist of alpha-numerical characters.
// Initiate main class $Input = new Input; $name = $Input->get ('name'); if ($Input->validate ('is_alnum', $name->value())) { // 'name' is now validated as an alpha-numerical string }
This example shows how to validate data if you do not use the Input class.
// Initiate Validation class $Validate = new Validate; $data = 'abc1234%'; if ($Validate->is_alnum ($data) ) { echo 'Success!'; } else { echo 'Failure!'; }
As you might see – it will return FALSE as $data contains a non-alpha-numerical character (%).