Re: str_replace: use multiple or array?

From: Date: Sat, 31 Jul 2004 04:55:41 +0000
Subject: Re: str_replace: use multiple or array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192377@lists.php.net to get a copy of this message
* Thus wrote PHP Gen: > Hi, > I need to use a couple of str_replace's in one of my > programs and would like to know which is more resource > friendly: > > 1) having multiple str_replace one after another > > eg: > $text = str_replace("orange", "apple", "$text"); > $text = str_replace("black", "white", "$text"); > ... > > 2) by using an array > > eg: > $bad = array("orange", "black", "girl", "woman", > "plant"); > $good = array("apple", "white", "guy", "man", > "tree"); > $text = str_replace($bad, $good, $text); #2 Anytime you can have the internals of php handle stuff for you the better it most likely will be. > > > Also, off topic, > Anybody else getting a non delivery message from: > MAILER-DAEMON@ rotonet.rsdb.nl I'll see what I can do about this. thanks for reminding me :) Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#192377) next »