Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

get file name without extension php 7.2 code example

Example 1: php get file extension from filename

$ext = pathinfo($filename, PATHINFO_EXTENSION);

Example 2: php get filename without extension

// Here is a quick way of fetching only the filename (without extension) regardless of what suffix the file has.

// your file
$file = 'image.jpg';
$info = pathinfo($file);
// Before PHP 5.2
$file_name =  basename($file, '.'.$info['extension']);
// After PHP 5.2
$file_name =  $info['filename'];

Tags:

Php Example

Related

Blank Node.js Web Application not in vs code code example what is addr client socket python code example bootstrap primary color hex code code example carousel multiple items bootstrap 4 code example transform camel case object to snake case + js code example c++ when is a class abstract code example how to rename column name in sql sp rename code example what are hooks in react js code example how to create public vars in python code example br after div code example how to compile pug to html code example join in thread code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy