Page 1 of 1

How to replace an ending?

Posted: Fri Feb 21, 2003 9:06 pm
by Darkside
How could I drop the ending of a file name and then add differnt ends later in the code?

Posted: Fri Feb 21, 2003 10:05 pm
by lazy_yogi
$filename = preg_replace('/\.\w+$/','',$filename);
then to add it .txt do
$filename .= ".txt";
and similar to add whatever else

Posted: Fri Feb 21, 2003 10:06 pm
by Darkside
thanks very much :P your like the only dood on this late

Posted: Sat Feb 22, 2003 1:53 am
by lazy_yogi
It's not late ..... it's not even 7 pm here ....