I have looked around for this but can only find links and references to this been done after an anchor hashtag but I need to get the value of the URL after the last / sign.
I have seen this used like this:
www.somesite.com/archive/some-post-or-article/53272
the last bit 53272
is a reference to an affiliate ID..
Thanks in advance folks.
This will work!
If you always have the id on the same place, and the actual link looks something like
http://www.somesite.com/archive/article-post-id/74355
Hope it helped :)
You can do it in one line with explode() and array_pop() :
I'm not an expert in PHP, but I would go for using the split function: http://php.net/manual/en/function.split.php
Use it to split a String representation of your URL with the '/' pattern, and it will return you an array of strings. You will be looking for the last element in the array.
PHPs parse_url (which extracts the path from the URL) combined with basename (which returns the last part) will solve this: