Advertisement
eaposztrof

simple way to slugify (clean URL) in php

Feb 11th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function url_clean($str){
  4.         $str = iconv('utf-8', 'us-ascii//TRANSLIT', $str);
  5.         $clean_str = preg_replace(array('/\'|\"/','/ /'),array('','-'),$str);
  6.         return $clean_str;
  7. }
  8.  
  9. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement