Saturday, July 4th, 2009

Tag Archives: extension

How to remove an extension from a filename

If you need for any reason to remove an extension from a filename (string) this snippet can help you. An extension in this case is everything after the last period from the whole string.

Read more

Get filename extension

This snippet can help you to get the extension of a filename:

<?php
… some code here …
// Filename
$filename = ‘public_html/root/internet.gif’;
// Extension
$ext = strrchr($filename, “.”);
echo $ext; // will return “.gif”
?>

Read more