How to extract a file extension in php?

Submitted by: Muhammad
Old method was
$path_info = pathinfo('/images/myPicture.gif');
echo $path_info['extension']; //will print gif

New way is
$filename = '/images/myPicture.gif';
$ext = pathinfo($filename, PATHINFO_EXTENSION);
echo $ext;//will print gif
Submitted by: Muhammad

Read Online PHP Job Interview Questions And Answers