if i have a link and i want to know what is the extension of that link how can i do that?

for example i have this link
$link = http://www.sdfsad.com/sada.rar
i want to get "rar"
Who is Participating?
RemcovCConnect With a Mentor Commented:
This should do the trick

$extension = Substr($link, strrpos($link,".")+1)
All Courses

From novice to tech pro — start learning today.