Get File Extension in PHP

The php itself is having an inbuilt function to extract or get the file extension.No need to write any regular expression or a custom code to extract the file extension in PHP.the below example will give you the how to use the php code to extract or get the file extension quickly.This is fastest way to extract the file extension. basename() in built function to get the basename of the file or image.

Example Code