How to extract a file extension in PHP?

PARSE_URL documentation

$x = parse_url(http://example.com/myfolder/sympony.mp3?aa=1&bb=2?cc=#gggg); $x[scheme] => http $x[host] => example.com $x[path] => /myfolder/sympony.mp3 $x[query] => aa=1&bb=2?cc= $x[fragment] => gggg

 PATHINFO documentation

$x = pathinfo(http://example.com/myfolder/sympony.mp3?aa=1&bb=2?cc=#gggg); $x[dirname] => http://example.com/myfolder $x[basename] => sympony.mp3?aa=1&bb=2?cc=#gggg $x[extension] => mp3?aa=1&bb=2?cc=#gggg $x[filename] => sympony