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: 14 years ago
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') -> 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);