PHP Classes

File: example

Recommend this page to a friend!
  Classes of Piotrek M   Validation Class RoyalHeart   example   Download  
File: example
Role: Example script
Content type: text/plain
Description: example
Class: Validation Class RoyalHeart
Validate string values
Author: By
Last change:
Date: 13 years ago
Size: 888 bytes


Class file image Download
require 'validation.class.php';

$validation = new validation;

 * here, into method checkString set array with name and content validation string
-> setString('first_string', 'Litwo! Ojczyzno maja! Ty jeste&#347; jak zdrowie...')
setString('second_string', '') //don't valid, because in rules is required ;]
-> setString('third_string', 'short string');

 * set rules :)
-> 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);