. */ /** * Doctrine_Validator_Creditcard * * @package Doctrine * @category Object Relational Mapping * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.phpdoctrine.com * @since 1.0 * @version $Revision$ * @author Konsta Vesterinen */ class Doctrine_Validator_Creditcard { /** * checks if given value is a valid credit card number * * @link http://www.owasp.org/index.php/OWASP_Validation_Regex_Repository * @param mixed $value * @return boolean */ public function validate($value) { return preg_match('#^((4\d{3})|(5[1-5]\d{2})|(6011)|(7\d{3}))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$#', $value); } }