mercredi 1 avril 2015

How to replace the tag/s present in an string with another string that represents some code in PHP?

I've one following string:



$feed_status = Nice <img src=\"http://ift.tt/1BZQwnH\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" /> to see <img src=\"http://ift.tt/1DvdU23\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" /> you all back again <img src=\"http://ift.tt/1F39V9j\" alt=\"Smile\" title=\"Smile\" title=\"v_middle\" />;


I've another array containing three elements which needs to be placed in above string in place of those <img> tags.



Array
(
[0] => \ue056
[1] => \ue057
[2] => \ue105
)


The three <img> tags from the string should be replaced by the above three strings in same order.


How should I achieve this in an optimum way?


Please help me. Thanks in advance.


My final string should be like this after printing :


Nice \ue056 to see \ue057 you all back again \ue105;


Aucun commentaire:

Enregistrer un commentaire