Altering file name with php -


i'm getting info out of rss feed.

how can change file name php?

say have filename:

http://anyurl.com/any_file_name_200.jpg 

i need change last part of "200.jp" number, "800.jpg". need dynamically, because "any_file_name" different, file names have same structure in end "123.jpg"

any ideas?

you can use preg_replace:

$filename = 'any_file_name_200.jpg'; $newfilename = preg_replace('/\d{3}\.jpg/','800.jpg',$filename); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -