PHP Text Dollar Values Being Removed from Output

Programming bug symptom of dollar values in user input being replaced by nothing in the output test, removed from output. The $ followed by numbers got deleted. $ and alpha didn’t. $ and a long number was partially deleted.

For example, $10.60 would become .60.

The bug was in a template library that used preg_replace. The replacement contained text that contained numbers like $10 $5. These were treated as backreferences.

The solution was to replace preg_replace with str_replace, which didn’t perform backreference substitution.

My searches included the following keywords, which were leading me on a wild goose chase: UTF-8 dollar $ unicode escapes libxml2 libxml options LIBXML_HTML_NOIMPLIED php DOM loadHTML dollar values replaced by nothing, removed.