I iterate over the array and for each record generates a unique identifier with uniqid:
foreach($emailsByCampaign as $campaign => $emails) {
$campaignHex = $this->strToHex($campaign);
$values = "(";
for ($i=0; $i<sizeof($emails);$i++) {
$values .= $analyticsDbInstance->escape($emails[$i]) . ",'" . uniqid(true) . "'), (";
}
}
The official documentation states that it uniqidgenerates idbased on microseconds. What is the likelihood that two cycles of the cycle will pass in less than two seconds, leading to unique identifiers?
source
share