How to get file extension in PHP

1 Answer

0 votes
function get_file_extension($file_name) {
    return substr(strrchr($file_name, '.'),1 );
}


echo get_file_extension('index.php');



/*
run:
  
php
     
*/

 



answered Sep 19, 2019 by avibootz
...