Posted By


jspicher on 10/09/09

Statistics


Viewed 69 times
Favorited by 1 user(s)

string_to_underscore($string)


/ Published in: PHP
Save to your folder(s)

Convert string to underscore, for SE safe URLs etc.


Copy this code and paste it in your HTML
  1. function string_to_underscore($string){
  2. $string = preg_replace('/[\'"]/', '', $string);
  3. $string = preg_replace('/[^a-zA-Z0-9]+/', '_', $string);
  4. $string = trim($string, '_');
  5. $string = strtolower($string);
  6. return $string;}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.