I have the "original list" and I'm trying to convert it to the "desired list" using php. When the .jpg is present at the end of the string, I want to do nothing. If .jpg isn't the end of the string, I want to add .jpg to the end.
Original List Desired List
http://ift.tt/2hyMt3a http://ift.tt/2hBPrB6
http://ift.tt/2hyWwFx http://ift.tt/2hyWwFx
http://ift.tt/2hBPahE http://ift.tt/2hyWGNb
http://ift.tt/2hBKgkZ http://ift.tt/2hyVIAI
http://ift.tt/2hBF8Ns http://ift.tt/2hBF8Ns
I've been using the following to modify a strings if someone added a , where a . belongs, but now I need to modify the sting only if the string doesn't end in .jpg.
$badPhotos = str_replace(',', '.', $badPhotos);
Ideas? Thanks!
Aucun commentaire:
Enregistrer un commentaire