PHP Classes

ISBN check: Validate ISBN-10, ISBN-13 and convert between them

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (8)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 1,519 This week: 1All time: 2,577 This week: 560Up
Version License PHP version Categories
isbncheck 0.3Public Domain5Validation
Description 

Author

This is a simple class to verify whether a given book's ISBN (International Standard Book Number) code is valid. Supports ISBN-10 and ISBN-13 and GTIN-14. Will perform conversions on valid numbers when possible.

Picture of Keith Nunn
  Performance   Level  
Name: Keith Nunn <contact>
Classes: 1 package by
Country: Canada Canada
Age: 57
All time rank: 183344 in Canada Canada
Week rank: 411 Up10 in Canada Canada Up

Example

<?php
   
echo "<html><body>\n";

   
/*
     * include class and create object
     */
   
include_once 'isbntest.class.php';
   
$currISBN = new ISBNtest;

   
/*
     * did we get an ISBN?
     */
   
if ($_REQUEST[isbn]) {
       
$currISBN->set_isbn($_REQUEST[isbn]);
        if (
$currISBN->valid_isbn10() === TRUE) {
            echo
"<p>The ISBN-10 " . $currISBN->get_isbn10() . " is <span style=\"color: green;\">valid</span>.</p>\n";
        } else {
            echo
"<p>The ISBN-10 " . $currISBN->get_isbn10() . " is <span style=\"color: red;\">invalid</span>.</p>\n";
            echo
"<p>The error reported is:<br /> " . $currISBN->get_error() . "</p>\n";
        }
        if (
$currISBN->valid_isbn13() === TRUE) {
            echo
"<p>The ISBN-13 " . $currISBN->get_isbn13() . " is <span style=\"color: green;\">valid</span>.</p>\n";
        } else {
            echo
"<p>The ISBN-13 " . $currISBN->get_isbn13() . " is <span style=\"color: red;\">invalid</span>.</p>\n";
            echo
"<p>The error reported is:<br /> " . $currISBN->get_error() . "</p>\n";
        }
    }

   
/*
     * input form
     */
   
echo "<FORM ACTION=\"" . $PHP_SELF . "\" METHOD=\"get\">\n";
    echo
"<B>isbn</B>\n";
    echo
"<INPUT TYPE=\"Text\" NAME=\"isbn\" SIZE=\"15\" MAXLENGTH=\"15\" VALUE=\"" . $_REQUEST[isbn] . "\">\n";
    echo
"<INPUT TYPE=\"Submit\" NAME=\"submit\" VALUE=\"Submit\">\n";
    echo
"</form>\n";

    echo
"</body></html>\n";

?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file cli_example.php Example just an example to show basic usage.
Accessible without login Plain text file example.php Example an example script showing usage
Plain text file isbntest.class.php Class class that does the ISBN checking

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,519
This week:1
All time:2,577
This week:560Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:-
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:452
 
Great!
15 years ago (Przemek Czekaj)
70%StarStarStarStar