I have a situation where I need to search a css file within PHP and replace all instances of the string 'logo.png' with whatever the client uploads. Let's say they upload 'logo.jpg' (notice the different file extension).
My problem is that the css content also contains a reference to an 'applogo.png' that I want to remain unchanged. But of course whenever I run the code below, it will change the 'applogo.png' to 'applogo.jpg':
$cssContent = str_replace('logo.png','logo.jpg',$cssContent);
How can I make sure that when I search and replace 'logo.png', that it ignores 'applogo.png'?
*There are instances where the quotes may or may not be included within the string, so including the quote is not reliable.
Any help or guidance towards resources is appreciated.