我必须根据时间、计数器和从 1 到 10 的随机前置值生成唯一 ID。我生成它的方式:
$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
正如你所看到的,上面的时间是一样的。他们都是。我在这里想念什么?