|
|
|
|
|
Simple function to format user input phone number. US phone number format.
| <?php
function phone_number($sPhone){
$sPhone = ereg_replace("[^0-9]",'',$sPhone);
if(strlen($sPhone) != 10) return(False);
$sArea = substr($sPhone,0,3);
$sPrefix = substr($sPhone,3,3);
$sNumber = substr($sPhone,6,4);
$sPhone = "(".$sArea.")".$sPrefix."-".$sNumber;
return($sPhone);
}
print phone_number(" (555) 555 - 1212 ");
?> | | |
|
| How to build a search query for any N number of words in a search string Categories : PHP, Regexps, Search Engines, Search | | | PHP Youtube Downloader - This is a set of PHP functions that can be used to download movies from Youtube.com.
Categories : PHP, CURL, Regexps | | | validateEmail 2.0 - upgraded version of the old validateEmail function used to validate email
addresses via SMTP and regex. Categories : Email, Regexps, PHP | | | Newbie Notes #7 - Ridiculous regex Categories : PHP, Beginner Guides, Regexps | | | email validator check checker email e-mail email address Categories : PHP, Email, Regexps | | | PHP Script to find url links in a page Categories : PHP, URLs, Regexps, Arrays | | | String Replacement and speed consideration
Categories : PHP, Strings, Regexps | | | FormChecker Package - validate any data via classes and patterns.
Categories : PHP, Form Processing, PHP Classes, Regexps | | | Tag content retrieval from websites with preg_match Categories : PHP, Regexps, Arrays, HTML and PHP | | | Avoiding or Detecting high bit characters in a string. Useful when you want to create a valid RSS feed Categories : PHP, Strings, Unicode, Regexps, Rich Site Summary (RSS) | | | Gets the browser and OS from the $_SERVER['http_user_agent'] variable in PHP Categories : PHP, HTTP, Regexps | | | Extract keywords from a string having words in " " count as one string. Categories : PHP, Strings, Regexps, Search | | | I need a trim function/regexp that will trim all " " from the ends of a string. Categories : Regexps, PHP, Strings | | | YellowPages Content Grabber (PHP5 +) Categories : PHP, PHP Classes, Regexps, Databases, MySQL | | | how to check if a string contains a letter from a different language? Categories : PHP, Regexps, Languages | |
| |
| |
|