How to get the extension of a filename...
Posted: Thu Sep 17, 2009 2:04 am
hi guys,
I have a problem with getting the extension of a filename...
at first what i did is to do like this
but i have a problem when the filename has a name like this:
$file = hello.cfg.inc.php;
with my code, i can get cfg instead of the php that i want to get....
So, how can i get the real file extension of a file?
thanks...
I have a problem with getting the extension of a filename...
at first what i did is to do like this
Code: Select all
$file = hello.php;
$ext= explode('.',$file);
//so i get $ext[1] which is .php
$file = hello.cfg.inc.php;
with my code, i can get cfg instead of the php that i want to get....
So, how can i get the real file extension of a file?
thanks...