Wednesday, September 14, 2022

How to remove extension from string in PHP


How to remove extension from string in PHP

There are multiple ways to remove extension from a file name in PHP
// Initializing a variable with filename
$file = 'myfilename.jpg';
// Extracting only filename using constants
$fileWithoutExt = pathinfo($file, PATHINFO_FILENAME);
// Printing the result
echo $fileWithoutExt;



1 comment:

  1. Cale Makar says the early portion of Avalanche schedule is “ridiculous.” Here’s how it’s exhibiting. We invite you to make use of ์ ๋ณด์นด์ง€๋…ธ our commenting platform to have interaction in insightful conversations about issues in our group. We might completely block any person who abuses these conditions. As of June 15, 2022, feedback on are powered by Viafoura, and you may need to log in once more to start commenting. If you need help or are having issues together with your commenting account, please e mail us at