[FX.php List] Getting floating point numbers through FX

Gjermund Gusland Thorsen ggt667 at gmail.com
Sun Oct 1 10:19:02 MDT 2006


Where did you get the coma "," ?

My FMSA outputs period "." as decimal separator

ggt667

On 9/30/06, Erik Andreas Cayré <erik at cayre.dk> wrote:
> Hi all,
>
> I've run into a problem getting non-integer numbers from FMSA8.0v4
> into php.
> I have no problems with integers, but when the numbers have
> fractions, I get into trouble...
>
> I'm guessing this has to do with how FX parses the XML output from FMSA.
> Does anyone now if all data in $FMResult['data'] is represented as
> strings?
>
> This code now works:
> 1                       foreach ($return_data['data'] as $key => $fmrecord)
> 2                       {
> 3                               if ($fmrecord['status'] == "paid")
> 4                               {
> 5                                       $_SESSION['turnover'] += $fmrecord['price'];
> 6                                       $_SESSION['balance'] += $fmrecord['price'] - strtr($fmrecord
> ['avance'], ",", ".");
> 7                               } else {
> 8                                       $_SESSION['canceledCount']++;
> 9                               }
> 10                      }
>
> because on line 6 I added strtr() to transform comma into decimal point
>
> This shouldn't be necessary.
> Is there a way to set a preference in FX or PHP affecting the type
> change from string to number?
>
> Any related comments?
>
>
>
> ---
> Erik Andreas Cayré
> Spangsbjerg Møllevej 169
> 6705 Esbjerg Ø
>
> Privat Tel: 75150512
> Mobil: 40161183
>
> ---
> »Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af
> 'markedsanalyse', men af folk, der er afsindigt irriterede over
> tingenes tilstand «
> --Tom Peters
>
> »Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt nok.«
> -- Albert Einstein
>
> »Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så have
> tid til at lave det om?«
> -- John Wooden, basketball coach
>
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
>


More information about the FX.php_List mailing list