Login   Register  
PHP Classes
elePHPant
Icontem

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: 2010-08-16 10:53
Size: 888 bytes
 

Contents

Class file image Download
<?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&#347; jak zdrowie...')
-> 
setString('second_string'''//don't valid, because in rules is required ;]
-> setString('third_string''short string');

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