Revision: 5094
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 11, 2008 16:03 by evanwalsh
Initial Code
<?php function str2url($title,$sep = "-"){ $exclude = array("!","@","#","$","%","^","&","*","(",")","=","{","}","[","]","|","\\","/","?","<",">","~","`","_","+","=","-"); $pieces = explode(' ',str_replace($exclude,"",strtolower($title))); $output = NULL; foreach($pieces as $key => $val){ if($pieces[$key+1] == NULL){ $sep = NULL; } $output .= $val.$sep; } return $output; } echo str2url("Evan Walsh Rocks"); // returns evan-walsh-rocks ?>
Initial URL
http://nothingconcept.com
Initial Description
Initial Title
Make string into post slug
Initial Tags
url, php, post, convert
Initial Language
PHP