How should one use preg_replace()
to replace a string from 'aabbaacc' to 'abc'?
Currently, my code uses str_split()
then array_unique()
then implode()
.
I think preg_replace()
can achieve this also, but I don't know how.
Thank you for your help.