Return to Snippet

Revision: 32596
at September 29, 2010 23:10 by antti


Initial Code
function makeInternetSafe($text) {
    
    $text = stripslashes($text);
    $text = mb_strtolower($text, 'utf-8');

    $forbidden = array('Ä', 'Ö', 'Å', 'ä', 'ö', 'å', ' ', '#');
    $replace   = array('A', 'O', 'a', 'a', 'o', 'a', '_', '-');
    $text      = str_replace($forbidden, $replace, $text);

    $text      = preg_replace('#[^a-z0-9._-]#', '', $text);

    return $text;
}

Initial URL


Initial Description


Initial Title
Make text net safe

Initial Tags
php, format, textmate

Initial Language
Other