Basically what I\'m looking for is the PHP version of this thread: Find, replace, and increment at each occurence of string
I would like to replace the keyword follow
preg_replace(array_fill(0, 5, '/'.$findme.'/'), range(1, 5), $string, 1);
Example:
preg_replace(array_fill(0, 5, '/\?/'), range(1, 5), 'a b ? c ? d ? e f g ? h ?', 1);
Output
a b 1 c 2 d 3 e f g 4 h 5