How to get filename without extension in PHP?

How to get filename without extension in PHP?

In this post we will give you information about How to get filename without extension in PHP?. Hear we will give you detail about How to get filename without extension in PHP?And how to use it also give you demo for it if it is necessary.

If you need to get just filename from url withour file extension then you can get that using basename() php function. In bellow example i give you how to get image name without extension. first we need to get extension of given filename url and then basename() through we can remove that extension like as i did bellow:

Example:

$imagePath = "/home/hd/html/test.jpg";

$ext = pathinfo($imagePath, PATHINFO_EXTENSION);


$file = basename($imagePath,".".$ext);

print_r($file);

Hope this code and post will helped you for implement How to get filename without extension in PHP?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

7  +  1  =  

We accept paid advance and paid guest Posting on our Site : Contact US