<?php
 
require 'validation.class.php';
 
 
$validation = new validation;
 
 
/**
 
 * here, into method checkString set array with name and content validation string
 
 */
 
$validation
 
-> setString('first_string', 'Litwo! Ojczyzno maja! Ty jesteś jak zdrowie...')
 
-> setString('second_string', '') //don't valid, because in rules is required ;]
 
-> setString('third_string', 'short string');
 
 
/**
 
 * set rules :)
 
 */
 
$validation 
 
-> setValidations( 'first_string') -> minlenght( 15) -> maxlenght( 1574)
 
-> setValidations( 'second_string') -> required( true)
 
-> setValidations( 'third_string') -> required( true) -> type( 'string') -> between( array( 10,1587)) -> start(); 
 
 
//check whether valid
 
echo ($validation -> isValid( array( 'first_string', 'second_string', 'third_string'))) ? 'Valid' : 'Don\'t valid';
 
 
//return array with errors
 
print_r( $validation -> error);
 
 |