3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/(")([^"]+)(")/'; $str = 'The nice man said "How\'s things today" and I replied "All is good thanks".'; $subst = '<i class="fa fa-quote-left" aria-hidden="true"></i>\\2<i class="fa fa-quote-right" aria-hidden="true"></i>'; echo preg_replace($re, $subst, $str);

preferences:
54.62 ms | 402 KiB | 5 Q