- substr: documentation ( source)
- mt_rand: documentation ( source)
<?php
class Tracking {
function __construct($client_id) {}
function createIdent($charcount) {
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$x = 0;
while ($x <= $charcount) {
$ident .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
$x++;
}
return $ident;
}
}
$tracking = new Tracking(1477);
echo $tracking->createIdent(7);