add

Thursday, March 8, 2012

PHP Number and strings validations

1. to check a valid phone number for Pakistan e.g 03001234567
    $number_pattern="/^3[0-9]{9}$/";
    $phoneNumber=03465315155
    $numberFormat = preg_match($Msisdn_pattern , $phoneNumber);

2. Format a number for proper usage
    $phoneNumber=03465315155;
    $phoneNumber='0092'.substr($_REQUEST["M"],-10);
   

No comments:

Post a Comment