Posted By

h4rrisonjames on 08/04/09


Tagged

php extension


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

calvingilbert
umang_nine


File Extension


 / Published in: PHP
 

Returns the file extension on a given input string. Useful for working with images.

  1. function extension($path)
  2. {
  3. $qpos = strpos($path, "?");
  4. if ($qpos!==false) $path = substr($path, 0, $qpos);
  5. $extension = pathinfo($path, PATHINFO_EXTENSION);
  6. return $extension;
  7. }

Report this snippet  

You need to login to post a comment.