/** * Validate a ISBN 13 number * The ISBN is a unique machine-readable identification number, * which marks any book unmistakably. * * This function checks given number according * * Manual can be found at http://www.isbn-international.org * * @param string $isbn number (only numeric chars will be considered) * @return bool true if number is valid, otherwise false * @access public * @author Helgi Þormar <*****@*****.**> * @author Piotr Klaban <*****@*****.**> */ function isbn13($isbn) { if (preg_match("/[^0-9 ISBN-]/", $isbn)) { return false; } $isbn = strtoupper($isbn); $isbn = str_replace(array('ISBN', '-', ' ', "\t", "\n"), '', $isbn); if (!preg_match('/^[0-9]{13}$/', $isbn)) { return false; } return Validate_ISPN::ean13($isbn); }