Computer >> Computer tutorials >  >> Programming >> PHP

uniqid() function in PHP


The uniqid() function generates a unique ID based on the current time in microseconds.

Syntax

uniqid(prefix, more_entropy)

Parameters

  • prefix − The prefix to the unique ID.

  • more_entropy − The more entropy at the end of the return value.

Return

The uniqid() function returns unique identifiers as string.

Example

<?php
   echo uniqid();
?>

Output

The following is the output.

5bfd5bd045faa