[PHP] Explain This!

SpaceshipSpaceship
Watch

beaver6813

Established Member
Impact
16
Heres one for you guys! I retrieve variables from an xml parser using simpelxml. It gives me a number in string format:
PHP:
var_dump($HandshakeTime);
Outputs:
Code:
string(13) "1255970476404"
I need to convert it into an integer so i'll do it this way:
PHP:
var_dump(($HandshakeTime+0));
Outputs:
Code:
int(2147483647)

What the deuce! How does the entire value change when converted to an integer?!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Overflow. 2147483647 is the maximum value for a signed 32-bit integer.
 
0
•••
Aha! I've never come across this before lol, is there any way around this limitation?
 
0
•••
Try using a library like BCmath if available on your platform (phpinfo will tell you).
 
0
•••
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back