
How to detect the file extension in PHP?

Read the given tutorial to detect the file extension in PHP.
The fileexists() function, fileexists php, file_exists in php

Here is the code for find Ext. of a file.
<?php
$filename = "filename.ext";
$a = explode('.',$filename);
$c = count($a);
$c = $c - 1;
$ext = $a[$c];
echo $ext;
?>
Regards, Kalpesh Shah.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.