Browse - Programming Tips - Old - How can I get a file's extension in php?

Date: 2017jun16
Language: php
Keywords: suffix

Q.  How can I get a file's extension in php?

A.  Use pathinfo like this.

function getExtension($file) { return pathinfo($file, PATHINFO_EXTENSION); }