Programming Tips - PHP: get file extension

Date: 2018sep6 Language: php Keywords: suffix Q. PHP: get file extension A.
function getExt(string $filename): string { if (($i = strrpos($filename, '.')) === false) return ''; return substr($filename, $i + 1); }
Using pathinfo() is the offical way but I prefer the above
function getExt2(string $filename): string { return pathinfo($filename, PATHINFO_EXTENSION); }