Page 1 of 1

preg_replace_callback

Posted: Sun Feb 22, 2009 3:33 pm
by abdabs
Hi,

When I'm using preg_replace(), it perfectly replace the patterns I want to replace in the correct manners.. BUT when using preg_replace_callback(), to replace a certain pattern with call on function, then what the function prints is appearing at the top of of the text, not in the middle of the text where it should be..

Why is this happening, and may I fix it?

Re: preg_replace_callback

Posted: Sun Feb 22, 2009 5:08 pm
by requinix
We could guess, but it'd be easier if you posted the code you have.

Re: preg_replace_callback

Posted: Sun Feb 22, 2009 5:57 pm
by josh
probably because your function is PRINTing, instead of returning.