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! Link to comment https://forums.phpfreaks.com/topic/163436-parameter-passing-incorrectly/ 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! Link to comment https://forums.phpfreaks.com/topic/163436-parameter-passing-incorrectly/#findComment-862333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.