/ Published in: PHP
URL: http://www.addedbytes.com
Function replaces all non-alpha-numeric chars and cleans up a text string. Should output a usable URL for almost all text.
Expand |
Embed | Plain Text
function generate_url_from_text($strText) { return $strText; }
Comments
Subscribe to comments
You need to login to post a comment.

Nice function for url RW!
This is the optimized version :
function generateurlfromtext($t) { return strtolower(pregreplace('/-+/','-',strreplace(' ','-',trim(pregreplace('/ +/',' ',preg_replace('/[^A-Za-z0-9-]/',' ',$t)))))); }