Created
October 9, 2022 14:49
-
-
Save rolandinsh/c08d9371fd1df6849b1e0d0cc436fa62 to your computer and use it in GitHub Desktop.
Check if is Amazon ASIN like code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isAsin($string){ | |
$asinpattern = "/B[0-9]{2}[0-9A-Z]{7}|[0-9]{9}(X|0-9])/"; | |
return preg_match($asinpattern, $string, $matches) === 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment