Using str_replace I want to change $url from this:
$url = http://example.com/images/lala1.jpg
to this
$url = http://example.com/images/lala1-0001.jpg
My problem is that I don't know how to insert the "-".
$url is changing so I really only know that it has ".jpg" at its' end.
My code so far:
for($i=1;$i<=9;$i++) {
$array[] = str_replace('.jpg',sprintf("%04d",$i).'.jpg',$url); }
Any idea how I can make this work?