NotionCommotion Posted April 1, 2017 Share Posted April 1, 2017 (edited) Just got the following error. Yes, it is a 32 bit machine. I thought I was able to go up to 8 as the last digit instead of 7 since I am starting at 1. That being said, I obviously don't care about the number being one more, but would like to figure out why it happened. Did I just get lucky and hit the jackpot? EDIT. Never mind. Guess I was wrong about going to 8... Warning: mt_rand(): max(-2147483648) is smaller than min(1) in /var/www/public/accounts.php on line 31 $id=mt_rand(1,2147483648 ); //Line 31 Edited April 1, 2017 by NotionCommotion Quote Link to comment Share on other sites More sharing options...
requinix Posted April 1, 2017 Share Posted April 1, 2017 Nope. It's 7 for positive, 8 for negative. Because 0 is counted on the positive side. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted April 2, 2017 Share Posted April 2, 2017 Use PHP_INT_MAX instead of trying to figure out the maximum value yourself. This is more reliable and doesn't require any adjustments when you switch to a different platform. 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.