| Viewed 204 times

How to generate a unique random string PHP?


How to generate a unique random string PHP?

PHP
1 Answer
Mohammad Qandeel
Answered
9

You can use a uniqid() function to get a unique id based on the current time in microseconds.

Example

<?php
    echo uniqid();
?>

 also, you can add a prefix and make the unique id more complex 

Example 

<?php
    echo uniqid('QA',true);
?>


Related Questions