Advertisement
GWibisono

make uri

Jan 3rd, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. $s=trim(strtolower($name));
  2.     $n=strlen($s);
  3.     if($n>90) $n=90;
  4.     for($i=0;$i<$n;$i++)
  5.     {
  6.         //===========bila bukan a-z atau 0-9 ganti -
  7.         $ordChr=ord($s[$i]);
  8.         $stat=FALSE;
  9.         if($ordChr >= 48 && $ordChr <=57)
  10.         {
  11.             $stat=TRUE;
  12.         }
  13.        
  14.         if($ordChr >= 97 && $ordChr <=122)
  15.         {
  16.             $stat=TRUE;
  17.         }
  18.        
  19.         if(!$stat)
  20.         {
  21.             $s[$i]="_";
  22.         }else{
  23.             //echo $s[$i].$ordChr;
  24.         }
  25.        
  26.     }
  27.      
  28.     $basename=$s;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement