The Code-Bin
Preg_replace with Function
Posted by: Stephen | February 9, 2008 @ 6:26pm
Revision 2 - Original post on February 9, 2008 @ 6:14pm

PHP Code



Syntax Highlighting





Author Comments
This will let you pass a backreference into a custom function. I personally use this in my own bbcode parser.

Preg_replace will sometimes perform addslashes() on input, so this manner is more desirable. (See http://natrak.net/node/300)
Rating


4.46 / 8
202 Votes