Posted By

d0ri0 on 03/25/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

IsraelTorres
eval


friendly url


 / Published in: PHP
 

  1. function makeURLFriendly($input){
  2. $output = strtolower($input);
  3. $output = preg_replace("/[^[:space:]a-z0-9]/e", "", $output);
  4. $output = trim($output);
  5. $output = preg_replace('/\s\s+/', '_', $output);
  6. return $output;
  7. }//function makeURLFriendly($input){
  8. echo $input = ' My Directory & Stuff ';
  9. echo '<br />';
  10. echo makeURLFriendly($input); // my_directory_stuff

Report this snippet  

You need to login to post a comment.