On Sat, 5 Jan 2013 04:20:09 -0600, Kevin Kinsey wrote:

> Nelson (et al),
> I've enjoyed reading this thread and apologize for dredging it up.
> It's interesting to see your progression of thought and the templating
> discussion is indeed a worthy one.
> However, I wanted to answer this objection from your initial message:
> >The reason I ask is because I am going to want to do three substitutions,
> >and I'd rather not do three str_replace calls if I don't have to.
> You *don't* have to; str_replace() is perfectly capable of handling
> arrays:
> =====
> $replace = array("USER","SITENAME","SOME_CONSTANT");
> $replacements = array($user,$site_name,$foo);
> $replaced = 
> str_replace($replace,$replacements,file_get_contents("/somefile.txt"));
> =====
> This, of course, doesn't negate a good templating system* ... but it's
> handy to know and you'll probably use it sooner or later.
> Kevin Kinsey
> P.S. *assuming that's not an oxymoron!


No apologies necessary, at least not to me. I always appreciate help and
I probably wouldn't have figured out your way on my own, at least not in
relation to what I am trying to do. And you've just proved once again that
there is almost always more than one way to accomplish a goal. I like this
solution as much as what I ended up with and will keep it handy.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to