greenba Posted April 13, 2008 Share Posted April 13, 2008 Hello to everyone, I would like to have only number values in a string from 0 to 9. What I use is: if (ereg ("([0-9]{6,13})", $string_one, $regs)) { echo "OK"; } but even if the string contains + or / - the validation seems to be OK, but I need it to be OK only when there are just numbers, nothing else. Any ideas? thanx Link to comment https://forums.phpfreaks.com/topic/100889-solved-check-string/ Share on other sites More sharing options...
Daniel0 Posted April 13, 2008 Share Posted April 13, 2008 Try to use is_int(). Link to comment https://forums.phpfreaks.com/topic/100889-solved-check-string/#findComment-515941 Share on other sites More sharing options...
greenba Posted April 13, 2008 Author Share Posted April 13, 2008 Thank you. Link to comment https://forums.phpfreaks.com/topic/100889-solved-check-string/#findComment-515944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.