我根據時間,計數器和隨機預謀值從1到10,我產生它的方式來生成唯一ID:PHP - 字符串爲int
$time = (int)(time()+$i);
$time = $time.(rand(1,9));
//At this step we have strings looking like this:
"13480835672" //This is time in first iteration
"13480835672" //This is time in second iteration
//But if I convert it to int
$time = (int)$time;
2147483647 //This is time converted in first iteration
2147483647 //This is time converted in second iteration
正如你可以看到上面的時間是一樣的。他們全部。我在這裏錯過了什麼?
32位整數限制 –
變量i是什麼? – Srijan
http://en.wikipedia.org/wiki/2147483647#2147483647_in_computing – sachleen