If I use:
$t = time();
echo $t;
This will output something like: 1319390934
I have two questions:
- This value can be used as unique id ?
- how to generate from it a date?
I can’t use uniqid(), because I need a value that can be used to order (recent).
Using
time()as mentioned will give you a sortable way to create unique IDs. Concatenating strings will also further randomize your desired result and still keep it sortable: