Skip to content

Instantly share code, notes, and snippets.

@devluis
Forked from apphp-snippets/gist:2759485
Last active August 29, 2015 14:19
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 devluis/c64bb716cf407a1a28c9 to your computer and use it in GitHub Desktop.
Save devluis/c64bb716cf407a1a28c9 to your computer and use it in GitHub Desktop.
<?php
/* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */
function makeMyUrlFriendly($url){
$output = preg_replace("/\s+/" , "_" , trim($url));
$output = preg_replace("/\W+/" , "" , $output);
$output = preg_replace("/_/" , "-" , $output);
return strtolower($output);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment