I want to do a str_replace for a HTML String, everytime find a match item the value will increase as well.
$link = 1;
$html = str_replace($this->link, $link, $html);
This would replace all in once, and with same string $link, i would like the $link increase every time it found an match. is it possible?
Thanks very much
If I understand you correctly (you want each match replaced with growing integer), it would seem the comments on the question encouraging you to use
preg_replace_callbackwould be correct: