Write a PHP program to get the extension of a file
<?php function file_extension($str1){ $str1=implode("",explode("\",$str1)); $str1=explode(".",$str1); $str1=strtolower(end($str1)); return $str1; } $file='example.txt'; echo "\n".file_extension($file)."\n"; ?>
Sample Output:
txt
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer