Reputation: 69
Using PHP, I need to change this
^0123456789...$
to this
0123456789xxx
^
on the start.$
on the end of the string..
for x
.Is it possible in only one ER?
Upvotes: 0
Views: 32
Reputation: 147166
The simplest way to do this is with str_replace
, no regex required:
$string = '^0123456789...$';
echo str_replace(array('.', '^', '$'), array('x', '', ''), $string);
Output:
0123456789xxx
Upvotes: 3