getMatches(); $issn = $matches[1] . $matches[2]; $check = 0; for ($i=0; $i<7; $i++) { $check += $issn[$i] * (8-$i); } $check = $check % 11; switch ($check) { case 0: $check = '0'; break; case 1: $check = 'X'; break; default: $check = (string) (11 - $check); } return ($issn[7] === $check); } // // Public static methods // /** * Return the regex for an ISSN check. This can be called * statically. * @return string */ static function getRegexp() { return '/^(\d{4})-(\d{3}[\dX])$/'; } } ?>