PHP Classes

File: Example

Recommend this page to a friend!
  Packages 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: 15 years ago
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"];
    }
}    
?>