preg_replace / ereg_replace / others???

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
hedon
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 7:27 am

preg_replace / ereg_replace / others???

Post by hedon »

Hi there... I'm experiencing some strange troubleshooting with my php5.

in a sequence like this:

Code: Select all

for ($i = 0; $i < count($replace_str); $i++) $indexTXT = str_replace($replace_str[$i], $with_str[$i], $indexTXT);
If strlen($indexTXT) is more than a few thousant characters, all I get is a blank page & I don't understand why.
Can u guys help me? It's starting to become too enoying.

Is there a more special configuration for php so it coud support bigger strings for preg_replace? From what I read in php documetation preg_replace is the most powerfull...
hedon
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 7:27 am

Post by hedon »

just discovered I experience the same problem with str_replace :((
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

If that's all the code you've got in your script, you will get a blank page if the script executes successfully...

If not, and you are sending something to the web browser somewhere, then maybe it's timing out, I can't remember the command off-hand but you could try adding an extra 10 seconds til script time-out on each loop.

You could also try echo'ing $i in each loop.

Make sure error_reporting is set to E_ALL aswell.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Could possibly be that PHP is hitting it's memory limit. I'm not sure exactly the context you're using this in.
hedon
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 7:27 am

Post by hedon »

the memory limit was up to 64Mb long before this happened.

I can't display all the code. I might be in trouble... :((

Anyway. 10x for helping.
Post Reply