I need to replace some word in the string. But the word inside the urls should not be replaced I don't know how to make a pattern that has a condition!
$str = 'hi iam working in shop. my shop address is: <br />
<a href="https://example.com/shop">shop</a> and my shop logo is: <br />
<img src="https://example.com/shop/shop-logo.png">';
$replace = 'store';
$patern = '/shop/';
echo preg_replace($patern,$replace,$str);