Skip to content

Instantly share code, notes, and snippets.

@dominikwilkowski
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominikwilkowski/8968477 to your computer and use it in GitHub Desktop.
Save dominikwilkowski/8968477 to your computer and use it in GitHub Desktop.
TINY STING TO URL CLEANER (Handleizer)
<?php
/*****************************| STRING TO URL |*****************************/
/**
* TINY STING TO URL CLEANER
*
* @param string $t String to be converted
*
* @return string string stripped off of all characters but A-Za-z0-9 and dash, spaces are converted to dash
*/
function makeURL($t) { return strtolower(substr(preg_replace("/[^\w-]+/","",str_replace(" ","-",$t)),0,20)); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment