Find the extension of filename in php

by rajesh 2010-01-03 15:54:52

we can use the function pathinfo to find or get the extension of the filename.

// First use the function pathinfo. send the filename as argument to pathinfo.
$info = pathinfo($file);

// the resulting array has the extension. we can fetch it as shown below.
$file_name = $info['extension'];

Tagged in:

867
like
0
dislike
0
mail
flag

You must LOGIN to add comments