phpknight Posted June 23, 2009 Share Posted June 23, 2009 Hi, I'm using Ajax with PHP and Javascript. I pass a function this number: 00000000000001525553. But when it gets there, it is this: 437099. PHP is processing it correctly, but Javascript is not. I fixed it by putting the number in single quotes as a single. However, I don't get why it messed up. What is happening here? Overflow? Are my padded zeros creating a problem? Is it doing an incorrect typecast? I'd like to know the cause of the problem. Thanks! Quote Link to comment Share on other sites More sharing options...
irvieto Posted June 23, 2009 Share Posted June 23, 2009 Acording to the rules of integers syntax http://php.net/manual/en/language.types.integer.php, numbers in format of 0[0-9]+ are considered in octal. So intval(00000000000001525553) is being parsed as From right to left... 3*(8^0) + 5*(8^1) + ... the rest we know.. which gives the magical number of 437099. Have a nice day! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.