Prevent accidental back-references
$conf['content'] = "Buy this thing for $300";
You can't ask the user building their configs to escape the dollar sign, and you can't just leave it as-is, otherwise you'll end up with something like "Buy this thing for 0". So before you do your preg_replace'ing, do this:
$content = preg_replace(
'/\\$\\d+/',
'\\\\$0',
$conf['content']
);
Written by Brandon Probst
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#