Return to Snippet

Revision: 18839
at October 9, 2009 16:50 by jspicher


Initial Code
function string_to_underscore($string){
    $string = preg_replace('/[\'"]/', '', $string);
    $string = preg_replace('/[^a-zA-Z0-9]+/', '_', $string);
    $string = trim($string, '_');
    $string = strtolower($string);
    return $string;}

Initial URL

                                

Initial Description
Convert string to underscore, for SE safe URLs etc.

Initial Title
string_to_underscore($string)

Initial Tags
php, search, text, function

Initial Language
PHP