Php > Strings
A function that parses a string and replaces
A function that parses a string and replaces function parse_body($str="") { $str_array = split (" ",$str); $sz = sizeof ($str_array); for ($i = 0; $i < $sz; $i++) { if (strstr($str_array[$i], "http://")) $fr = sprintf ("%s
%s
", $fr, $str_array[$i], $str_array[$i]); else if (strstr($str_array[$i], "@")) { if (strstr($str_array[$i], ".")) $fr = sprintf ("%s
%s
", $fr, $str_array[$i], $str_array[$i]); else $fr = sprintf ("%s %s", $fr, $str_array[$i]); } else $fr = sprintf ("%s %s", $fr, $str_array[$i]); } return $fr; } ?> --- Use this function to parse a string for url or mailto addresses. If there is a @ sign and a . it replaces it with mailt:(that string), and also looks for http:// Use in the following format: $new_str = parse_body($str); echo("$str"); Seth
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage