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 :/ Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/ 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)) { Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-786940 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 Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-786941 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 Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-786954 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)) { Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-787031 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,. Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-787033 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 >_> Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-787035 Share on other sites More sharing options...
syed Posted March 18, 2009 Share Posted March 18, 2009 pro plus Link to comment https://forums.phpfreaks.com/topic/149853-solved-cant-get-eregi-working/#findComment-787642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.