Login   Register  
PHP Classes

File: example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 4 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') -> minlenght15) -> maxlenght1574)
setValidations'second_string') -> requiredtrue)
setValidations'third_string') -> requiredtrue) -> 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);