PHP - Cutting filenames -


I was thinking that someone could help me.

The filename I have been output from my database is the following format

file name -144 x96.jpg

file name -144 x180.jpg

file-name-144x180.jpg

etc etc etc

Is there any way that I can end up with everything else Am I?

Once processed, file names will be

filename.jpg

filename.jpg

file-name. Jpg

One problem in im is that it is trying to understand one.

Cheers,

  & lt; Php $ filename = "file -name-1440x80.jpg"; Echo preg_replace ("/ - \ d + x \ d + / i", "", $ filename); // print file-name Jpg? & Gt;    

Comments