runnerpaul Posted February 2, 2011 Share Posted February 2, 2011 Could somebody please explain what the below code means? if(!mb_ereg("^[0-9)(xX -]{7,20}$",$value)) I just understand it. It comes from the following: if(mb_eregi("phone",$field) or mb_eregi("fax",$field)) { if(!mb_ereg("^[0-9)(xX -]{7,20}$",$value)) { $errors[] = "$value is not a valid phone number. "; } } Cheers Paul Quote Link to comment https://forums.phpfreaks.com/topic/226514-trying-to-understand-code/ Share on other sites More sharing options...
.josh Posted February 3, 2011 Share Posted February 3, 2011 mb_ereg basically that code says: if the value of $field contains "phone" or "fax" then... ...if the value of $value does NOT have between 7 and 20 of only these characters: 0-9)(xX - .... then add that error message to the $errors array Quote Link to comment https://forums.phpfreaks.com/topic/226514-trying-to-understand-code/#findComment-1169166 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.