How to get filename from path in PHP?

By Hardik Savani September 5, 2020 Category : PHP

Sometimes, we may require to get only filename or image name from full path or url in your PHP project or any framwwork project at that time you can get file name using php pre-define function basename.

If you ever use this function then you can see as bellow example how it's works. I have one image url like, i want to just get image name then you can get image name like this way :

Example:

basename("http://itsolutionstuff.com/upload/Laravel-5-Mailgun.png");

We are Recommending you