[thelist] Replacing periods with commas

Brady Mitchell mydarb at gmail.com
Fri Jan 4 11:34:41 CST 2008


On Jan 4, 2008 5:49 AM,  <ftarzwell at fayec.com> wrote:
> Thank you for the help. Will using this alternate way mess up the rest of
> the code?

Nope. The way you're currently doing the replace is counting the
number of characters in the string and doing the replace at a specific
location. This approach is useful in certain situations, but when
you're simply replacing a character regardless of where it is in the
string, strtr is definitely an easier way to do it.

> Also, based on the php.net page it should be $change, "string $from",
> "string $to".
> In this case should I write ($change, '.', ',') ??

Yes, I had it backwards. Sorry about that.

Brady



More information about the thelist mailing list