FabrizioCaldarelli
7/20/2016 - 8:24 PM

Generate unique code string in PHP

Generate unique code string in PHP

<?php

// In this case, 4bytes, 8 charactes.
$bytes  =  4;
$cstrong   =  true;
$uid       =  bin2hex(openssl_random_pseudo_bytes($bytes, $cstrong));
?>