Situation
I want to use preg_replace()
to add a digit '8'
after each of [aeiou]
.
Example
from
abcdefghij
to
a8bcde8fghi8j
Question
How should I write the replacement string?
// input string
$in = 'abcdefghij';
// this obviously won't work ----------↓
$out = preg_replace( '/([aeiou])/', '\18', $in);
This is just an example, so suggesting str_replace()
is not a valid answer.
I want to know how to have number after backreference in the replacement string.