I have a pixel like:
<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=[ID_MTG]&data=[TEL]' height='1' width='1' border='0'/>
I need to replace the keys [TEL] and [ID_MTG] with the value I receive from a script. For example if I have:
$tel = "0613321223";
$id_mtg = "4875";
$email = "thatmail@gmail.com";
I need to output:
<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=4875&data=0613321223' height='1' width='1' border='0'/>
If I have:
<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=[ID_MTG]&data=[EMAIL]' height='1' width='1' border='0'/>
I need to ouput:
<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=4875&data=thatmail@gmail.com' height='1' width='1' border='0'/>
I have:
$tel = "0613357221";
$email = "Chachachou@gmail.com";
$id_mtg = "560";
$string = "<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=[TEL]&data=[ID_MTG]' height='1' width='1' border='0'/>";
$patterns = array();
$patterns[0] = ' /\[TEL\]/ ';
$patterns[1] = ' /\[EMAIL\]/ ';
$patterns[2] = ' /\[ID_MTG\]/ ';
$replacements = array();
$replacements[2] = $id_mtg;
$replacements[1] = $email;
$replacements[0] = $tel;
echo htmlentities(preg_replace($patterns, $replacements, $string));
But my string is:
<img src='http://www.montag.com/directory_folder/tracking_noip.php?tracking=520&data=0613357221' height='1' width='1' border='0'/>
The order is reversed.