Page 1 of 1

Problems with a long integer

Posted: Thu Feb 24, 2011 9:29 am
by cluster28
I have a WSDL that it returns this field:

<xsd:element maxOccurs="1" minOccurs="1" name="CO-RFR-AVE-ICD-TDE" nillable="false" type="xsd:long"/>

The field content returned is 20110094012838001.

I made an echo and the result was 2.01100940128E+16.

How can i display the field content correctly?

I´ve tried

Code: Select all

 
(string)$field
settype($field,'string')
$string_field='-'.$field

Re: Problems with a long integer

Posted: Thu Feb 24, 2011 9:40 am
by Weirdan
You can display it like this:

Code: Select all

printf("%.0f", $number);
However you cannot expect it to work like an integer because it exceeds integer range for you platform (32bit). Maximum positive integer PHP can treat as a native integer is likely 2147483648 in your case.