Eiolon Posted July 22, 2008 Share Posted July 22, 2008 I have a script that queries a database of barcodes. The barcodes always start with 29971 and have an additional 9 numbers after it. I need a way to make sure anything that does not start with 29971 gets rejected. Any ideas? Link to comment https://forums.phpfreaks.com/topic/115932-validating-part-of-a-number/ Share on other sites More sharing options...
Stephen Posted July 22, 2008 Share Posted July 22, 2008 Try something like: $_barcode=29971042354455; if (substr(strval($_barcode),0,5)==="29971")) { echo("Correct"); } Link to comment https://forums.phpfreaks.com/topic/115932-validating-part-of-a-number/#findComment-596061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.