[FX.php List] Getting floating point numbers through FX
Erik Andreas Cayré
erik at cayre.dk
Sat Sep 30 12:50:08 MDT 2006
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1856 bytes
Desc: not available
Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20060930/8c316e2f/smime.bin
More information about the FX.php_List
mailing list