Get File Extension from Path in PHP

Last modified: 
Thursday, August 27th, 2015
Topics: 
PHP
$path = "http://example.com/file.jpg";
$extension = pathinfo($path, PATHINFO_EXTENSION);
print $extension; // Prints "jpg".


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.