Regex Mobile Number Validation Code Doesn't Work In PHP -


    function pricerrtheme_isvalidnumber($number) {     return eregi("^(?:01)?01[0-9]\d{8}$", $number); } 

hello, add validation code validates mobile numbers following area codes

0100,0101,0106,0109 

then 7 digits after looks this

01005555555 or 01015555555

my code doesn't work, gives me validation error doesn't matter if entered right or wrong values

this might further.

 $phone = "01005555555";     if(preg_match("/^010[0|1|6|9][0-9]{7}$/", $phone)) {    echo "valid";    }    else {     echo "invalid";    } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -