Devin Walker is a San Diego based entrepreneur, developer and designer.

Use preg_replace to replace the contents of a tag

Posted on Feb 1, 2011 in Coding | No Comments

I often need to replace the contents of a tag using php with another variable. This is made easy with the preg_replace() function and a nifty regular expression.

http://stackoverflow.com/questions/7139342/preg-replace-how-to-remove-contents-inside-a-tag