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
Post a Comment