| Start |
|---|
| Using parse_url() parse_url(): This function parses a URL and returns an associative array containing any of the various components of the URL that are present. If you need the path separated you can use explode If you need the last part of the section you can use end() like this: If the URL contains GET vars you can retrieve those as well If you wish to break down the query vars you can use parse_str() like this: |
| Using explode() explode(): Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter. This function is pretty much straight forward. You can retrieve the last part of the URL by doing this: You can also navigate inside the array by using sizeof() in combination with a math operator like this: |
| Using basename() basename(): Given a string containing the path to a file or directory, this function will return the trailing name component. This function will return only the last part of an URL If your URL has more stuff to it and what you need is the dir name containing the file you can use it with dirname() like this: |
Read Article
https://develop.horje.com/learn/1434/reference