Jump to content

any way to count # of replacements and add integer?


dj-kenpo

Recommended Posts

I'm trying to replace occurances of

<IMG src="cid:7C9A73FA-F063-4654-8278-80110A5A2B16@local">

type tags in emails displayed in a browser. they come from inline images in emails

 

$cid_counter=0;
$body = preg_replace('/"cid:/', '"imap_file_download.php?folder=Inbox&file=0&msgno=289m=view&cid='.$cid_counter++, $body, 100,$cid_count);

 

replaces it, but $cid_counter will not increment (stays at 0 as expected, so will microtime), and $cid_count simply gives me a total number of replacements (and cannot be put back in..)

 

this won't allow me to link the new link to an image, as if there's 5 cid's they now all have the same link. there's no variable to differentiate them....

 

is there some way I go do a for loop to replace one at a time using the number of replacements??

for instance, if I know there's 2 occurances of cid, can I somehow do another replace and make one designated as 1, and another 2?

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.