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 Jakub Kuritka  >  Leopard Validator  >  Example  >  Download  
File: Example
Role: Example script
Content type: text/plain
Description: Example of using
Class: Leopard Validator
Validate text values using several rules
Author: By
Last change: Updated comment
Date: 2011-03-23 10:51
Size: 421 bytes
 

Contents

Class file image Download
<?php
include "leopardValidator.php";

$result leopardValidator::validate(array(
    
rules::NOTEMPTY,
    
rules::MINS => 2),
    
"Some text to validate");

if(
$result){
    echo 
"All is ok";
} else {
    
//$result is array of don't met rules
    
foreach($result as $rule){
        echo 
$rule["rule"];
        
//in this example is argument by rule - rules::MINS
        
if(isset($rule["argument"])
            echo 
$rule["argument"];
    }
}    
?>