In fact, it does exist, but few people know it. Meet pathinfo():
$ext = pathinfo($filename, PATHINFO_EXTENSION);
This is fast, efficient, reliable and built-in. pathinfo() can give you other information, such as canonical path, depending on the constant you pass to it.
No comments:
Post a Comment