Read filename from URL

I needed the function to get the filename with extension from a URL. I searched about it and found people who split their URL in 100 pieces. But none of these code snippets were good. This is why I post my solution here.