PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Thomas Björk  >  udPattern  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: A quick example
Class: udPattern
A simple way to check strings against patterns.
Author: By
Last change:
Date: 13 years ago
Size: 562 bytes
 

Contents

Class file image Download
<?php
// Example
include_once("udPattern.php");
$check = new udPattern();
$check->Add("www.www.www", ".");
$check->Add("%.www.www", ".");
$check->Add("-*", ".");
if((
$test = $check->TestPattern($_SERVER['HTTP_HOST'],false,".")) !== false) {
  if(
$test < 0) {
    echo
"The server does not accept this address";
  } elseif(
$test > 0) {
    echo
"The address is accepted by the server";
  } else {
    echo
"The server uses easyTest and has accepted the address without any matching found";
  }
} else {
  echo
"Failed to match the address";
}
?>