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

 Live Demo

<?php
   echo uniqid();
?>

Output

The following is the output.

5bfd5bd045faa
Updated on: 2019-12-30T06:59:26+05:30

329 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements