Skip to content

Instantly share code, notes, and snippets.

@jaonoctus
Created September 9, 2015 11:32
Show Gist options
  • Save jaonoctus/5f0672c71ab0a9abeee5 to your computer and use it in GitHub Desktop.
Save jaonoctus/5f0672c71ab0a9abeee5 to your computer and use it in GitHub Desktop.
<?php
/**
* [1] http://yourdomain.com/folder/folder2/link
* [2] http://yourdomain.com/link
*
* in both cases above, getURL() return "link".
* so, always taking the last parameter.
*/
function getURL() {
$url = $_SERVER['REQUEST_URI'];
$url = explode("/", $url);
$url = end($url);
$url = explode(".", $url);
$url = $url[0];
return $url;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment