How to get filename from path in PHP?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i will show you How to get filename from path in PHP? Sometimes, we need to get only filename or the image name from our full path or the url in our PHP project or any others framwork .On that time we can get the file name by using php pre-define function basename.

So If we ever use this function then we can see as like as bellow example how it’s works. Now I have one image url like, now i want to just get the image name then we can get image name like this way :

Example:

basename("http://codingspoint.com/upload/profile_image.png");

Read Also : How to Create Custom Blade Directive in Laravel?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →