dj-kenpo Posted September 18, 2007 Share Posted September 18, 2007 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 https://forums.phpfreaks.com/topic/69727-any-way-to-count-of-replacements-and-add-integer/ Share on other sites More sharing options...
effigy Posted September 18, 2007 Share Posted September 18, 2007 Try preg_replace_callback. Link to comment https://forums.phpfreaks.com/topic/69727-any-way-to-count-of-replacements-and-add-integer/#findComment-350427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.