I've got a section of code on a b2evo PHP site that does the following:
$content = preg_replace_callback(
'/[\x80-\xff]/',
create_function( '$j', 'return "&#".ord($j[0]).";";' ),
$content);
What does this section of code do? My guess is that it strips out ascii characters between 128 and 256, but I can't be sure.
Also, as it stands, every time this bit of code is called from within a page, PHP allocates and then does not free upto 2K of memory. If the function is called 1000+ times on a page (this can happen), then the page uses an extra 2MB of memory.
This is causing problems with my web application. Why am I losing memory, and how do I rewrite this so I don't get a memory leak?