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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.