WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Banknote Validation - A PHP class that provides several methods to quickly validate banknote serial numbers of the following currencies: AUD, CAD, CHF, CNY, EUR, GBP, JPY, USD.
Categories : PHP, PHP Classes, Data Validation, Regexps Click here to Update Your Picture
Alix Axel
Date : Apr 28th 2009
Grade : 3 of 5 (graded 1 times)
Viewed : 1709
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Alix Axel
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

<?php

class Is_Banknote
{
    function
AUD($string)
    {
        if (
preg_match('~^[a-z]{2}\d{8}$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
CAD($string)
    {
        if (
preg_match('~^[a-z*]?[a-z]{2}\d{7}$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
CHF($string)
    {
        if (
preg_match('~^\d{2}[a-z]\d{7}$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
CNY($string)
    {
        if (
preg_match('~^[a-z]{1,2}(?:\d{6}|\d{8})$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
EUR($string)
    {
        if (
preg_match('~^[a-z]\d{11}$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
GBP($string)
    {
        if (
preg_match('~^[a-z]{2,3}\d{6,7}$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
JPY($string)
    {
        if (
preg_match('~^[a-z]{1,2}\d{6}[a-z]$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }

    function
USD($string)
    {
        if (
preg_match('~^[a-z]?[a-l]\d{8}[a-np-z*]$~i', $string) > 0)
        {
            return
true;
        }

        return
false;
    }
}
?>



Usage:

<?php
var_dump
(Is_Banknote::AUD('serial number here'));
var_dump(Is_Banknote::CAD('serial number here'));
var_dump(Is_Banknote::CHF('serial number here'));
var_dump(Is_Banknote::CNY('serial number here'));
var_dump(Is_Banknote::EUR('serial number here'));
var_dump(Is_Banknote::GBP('serial number here'));
var_dump(Is_Banknote::JPY('serial number here'));
var_dump(Is_Banknote::USD('serial number here'));
?>



Power Form Validation
Categories : PHP, PHP Classes, Data Validation
Validating a URL with preg_match
Categories : PHP, Regexps, Beginner Guides, Data Validation
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
PHP Image Validation Class - test if a specific file is of a certain image type without relying on the said file extension.
Categories : PHP, PHP Classes, Data Validation, Graphics, Beginner Guides
EAvalidator - This class can be used to validate an e-mail address by checking its domain.
Categories : PHP, PHP Classes, Email, Regexps
The GTV.class allows you to extract a value between any HTML tag or between any TEXT on a web page.
Categories : PHP, PHP Classes, Regexps
FormChecker Package - validate any data via classes and patterns.
Categories : PHP, Form Processing, PHP Classes, Regexps
Form is a utility class for generating html forms. It provides form initialization and regex based data validation (both server and client side) with a convenient interface. This version obsoletes version 1.0a
Categories : HTML, PHP, PHP Classes, Regexps
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL
Validator - A PHP class that can can be used for validating Email IDs and Dates
Categories : PHP, PHP Classes, Data Validation, Email, Date Time
Parsing Simple Template Files and Data
Categories : PHP, PHP Classes, Templates, Regexps
Check for functional file links (broken Files)
Categories : PHP, Data Validation, FTP, Regexps, Arrays
An array of functions to use in checking user input to HTML forms : text, firstName, middleNameOrInit, lastName, email, web, digits, decimal, hex, genNum, USD, BPS, Euro, USphone, USzip
Categories : PHP, Data Validation, Regexps
making links from text
Categories : PHP, Regexps, Email
Automatic Browsers Detect
Categories : PHP, PHP Classes, Headers, Browsers