How to get filename without extension in PHP?By Hardik Savani | May 26, 2016 | | 1710 Viewer | Category : PHP
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:
$imagePath = "/home/hd/html/test.jpg";
$ext = pathinfo($imagePath, PATHINFO_EXTENSION);
$file = basename($imagePath,".".$ext);
- Laravel 5.3 - Call to undefined method Illuminate\Database\Query\Builder::lists() Solved
- Bootstrap - maxlength validation with count remaining character example
- Laravel 5 - where condition with two columns example code
- AngularJS - convert comma separated string to array example
- Codeigniter 3 - CRUD(Create, Read, Update and Delete) using JQuery Ajax, Bootstrap, Models and MySQL
- PHP Codeigniter - Ajax Infinite Scroll Pagination Example
- How to remove # from URL in AngularJS?
- How to prevent submit form on enter key except textarea in JQuery?