virtuexru Posted March 13, 2007 Share Posted March 13, 2007 I want to make sure my users are entering their phone in a certain format, namely... 000-000-0000 where 0 = any #. how would i setup a preg_match function to check that? Link to comment https://forums.phpfreaks.com/topic/42531-solved-phone-number-verifcation/ Share on other sites More sharing options...
bwochinski Posted March 13, 2007 Share Posted March 13, 2007 <?php $number = '555-123-9876'; if ( preg_match('/^\d{3}-\d{3}-\d{4}$/',$number) ) { valid! } else { Invalid! } ?> Link to comment https://forums.phpfreaks.com/topic/42531-solved-phone-number-verifcation/#findComment-206376 Share on other sites More sharing options...
effigy Posted March 13, 2007 Share Posted March 13, 2007 See this in regards to the use of $. Link to comment https://forums.phpfreaks.com/topic/42531-solved-phone-number-verifcation/#findComment-206402 Share on other sites More sharing options...
virtuexru Posted March 13, 2007 Author Share Posted March 13, 2007 Perfecto Bwochinski, thank you. Link to comment https://forums.phpfreaks.com/topic/42531-solved-phone-number-verifcation/#findComment-206406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.