This is a follow up on this question Use PHP to Get File Path/Extension from URL string
Given a string which is a URL: http://i.imgur.com/test.png&stuff
How do I get the name of a file: test.png
without query parameters?
If I try suggested solution: parse_url($url, PHP_URL_PATH)
I get /test.png&stuff