$url = 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($url);
$path = $parts['path'];
$keys = explode('/', $path);
$id = array_pop($keys);
echo $keys[$id]; // will echo the last element in the url
echo $keys[4]; // corresponding to the 4th url word
Generates URL segments not specific to any framework (core PHP only)
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.