aebstract Posted March 17, 2009 Share Posted March 17, 2009 if (eregi($var1, "^[0-9]{4}$")) { echo "yeah"; } else { Well, I echo $var1 above this if statement, and it displays 1000. Which should match my statement? So I should end up echoing 'yeah' correct? It does everything in the else section. Not sure what's up :/ Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 17, 2009 Share Posted March 17, 2009 pattern comes before the variable. and, you should use single quotes: if (eregi('^[0-9]{4}$',$var1)) { Quote Link to comment Share on other sites More sharing options...
syed Posted March 17, 2009 Share Posted March 17, 2009 ergie function, first arg is pattern second arg is string Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 17, 2009 Author Share Posted March 17, 2009 O.O what a stupid mistake. Thanks Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 17, 2009 Author Share Posted March 17, 2009 Okay. Was fine and working when I switched their placement, but now it isn't working again: $var1 is 2147483646 and if (eregi('^[0-9]{10}$', $var1)) { Quote Link to comment Share on other sites More sharing options...
samshel Posted March 17, 2009 Share Posted March 17, 2009 works for me.. could you post some code before and after this condition if there is,. Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 17, 2009 Author Share Posted March 17, 2009 Apparently I didn't upload the file. I need to go home for the day >_> Quote Link to comment Share on other sites More sharing options...
syed Posted March 18, 2009 Share Posted March 18, 2009 pro plus Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.