| : | Javascript | : | PHP Index | : | MySQL | : |
| : | Source | : | : | Explanation | : | : | Example | : | : | Todo | : | : | Feedback | : |
Fill in an isbn number below to check if it's valid.
The check is done by the function (not the class) shown on the source page
Unfortunately, the server on which this website is hosted doesn't support the PHP version necessary for Zend Framework, so i won't be able to give a live
demonstration of the Excudo_Validate_ISBN class. But here is a code example anyways:
<?php
// this file contains the Excudo_Validate_Isbn classs
require_once "Excudo/Validate/Isbn.php";
$isbns = array(
"1",
"978905451584",
"9789054515845",
"97890545158456",
"9789054515844",
);
$Validator = new Excudo_Validate_Isbn();
foreach ($isbns AS $isbn)
{
$bool = $Validator->isValid($isbn);
if ($bool)
{
echo "<span style=\"color: green; font-weight: bold;\">".$isbn."</span> is a valid isbn number<br>\n";
}
else
{
echo "<span style=\"color: red;\">Error:</span> ".end($Validator->getMessages())."<br>\n";
}
}
?>
This will produce the following output: