I has a string
$text =<<<HTML
<div align="center"><center><img src='http://ecx.images-amazon.com/images/I/41KZa6thzcL._SS500_.jpg' alt="The Birthday of the World: And Other Stories"/></center><br/>
thanks all "coder". </div>
HTML;
I want replace all " from tag with \" or ' with \' and don't replace if " or ' not in tag
and result is
$text =<<<HTML
<div align=\"center\"><center><img src=\'http://ecx.images-amazon.com/images/I/41KZa6thzcL._SS500_.jpg\' alt=\"The Birthday of the World: And Other Stories\"/></center><br/>
thanks all "coder".
</div>
HTML;
Please help me . Great Thanks