preg_replace_callback

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
abdabs
Forum Newbie
Posts: 7
Joined: Tue Aug 08, 2006 6:26 am

preg_replace_callback

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: preg_replace_callback

Post by requinix »

We could guess, but it'd be easier if you posted the code you have.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: preg_replace_callback

Post by josh »

probably because your function is PRINTing, instead of returning.
Post Reply