PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of simone   Abstract Validation Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Abstract Validation Class
Validate text values of different types
Author: By
Last change: tag <?php?> script
Date: 10 years ago
Size: 1,222 bytes
 

Contents

Class file image Download
<?php

require_once 'Validator/String.php';
require_once
'Validator/EmailAddress.php';

$string = 'example text';
$stringValidator = new Validator_String($string);

echo
'Class Validator_String(\'example text\');<br>';
echo
'Validator_String->isValid() => ' .$stringValidator->isValid();
echo
'<br>';
echo
'Validator_String->isValid(\'param in method\') : ' .$stringValidator->isValid('param in method');
echo
'<br>';
echo
'Validator_String->isValid(3) : ' .$stringValidator->isValid(3);

echo
'<br><br><br>';

$emailAddress = 'example@yourdomain.com';
$emailAddressValidator = new Validator_EmailAddress($emailAddress);
echo
'Class Validator_EmailAddress(\'example@yourdomain.com\');<br>';
echo
'Validator_EmailAddress->isValid() : ' .$emailAddressValidator->isValid();
echo
'<br>';
echo
'Validator_EmailAddress->getDomain() : ' .$emailAddressValidator->getDomain();
echo
'<br>';
echo
'Validator_EmailAddress->getUserAddress() : ' .$emailAddressValidator->getUserAddress();
echo
'<br>';
$emailAddressValidator->set('wrongemail@fakedomain');
echo
'Validator_EmailAddress->set(\'wrongemail@fakedomain\')<br>';
echo
'Validator_EmailAddress->isValid() : ' .$emailAddressValidator->isValid();

?>