Home » Php » Getting File Name without Extension [duplicate]

Getting File Name without Extension [duplicate]

Posted by: admin November 29, 2017 Leave a comment

Questions:

This question already has an answer here:

Answers:

As an alternative, if you do not want string operations you can use pathinfo():

$name = 'file.jpg';
$file_name = pathinfo($name, PATHINFO_FILENAME); // file
$extension = pathinfo($name, PATHINFO_EXTENSION); // jpg

Leave a Reply

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