What is it that you are actually wanting it to do if you don't mind me asking? And also what is the comma issue? -----Original Message----- From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of ftarzwell at fayec.com Sent: 04 January 2008 13:49 To: thelist at lists.evolt.org Subject: Re: [thelist] Replacing periods with commas >>On Jan 3, 2008 1:16 PM, <ftarzwell at fayec.com> wrote: >> >> I have an output file that should display: >> 864,7 $ +8.2 >> Instead it's showing: >> 86,.7 $ +,.2 >> >> The code that does the replacement of the period for a comma is as follows: >> $change = substr_replace($change, ",", strlen($change) - 3, 1); >> >> Should the code be: >> $change = substr_replace($change, ",", strlen($change) - 2, 1); >> >> in order to fix the comma issue? > >Actually, I'd use strtr (http://php.net/strtr) instead: > >$change = strtr($change, ',' , '.'); > >That way you never have to worry about how many digits are in the number. > >Brady Hi Brady, Thank you for the help. Will using this alternate way mess up the rest of the code? Also, based on the php.net page it should be $change, "string $from", "string $to". In this case should I write ($change, '.', ',') ?? Thanks, FayeC -- * * Please support the community that supports you. * * http://evolt.org/help_support_evolt/ For unsubscribe and other options, including the Tip Harvester and archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt !