Generating a Unique Identifier : sha1 « Utility Function « PHP
- PHP
- Utility Function
- sha1
Generating a Unique Identifier
<?php
function create_unique() {
$data = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'] . time() . rand();
return sha1($data);
}
$newhash = create_unique();
echo "<pre>{$newhash}</pre>";
?>
Related examples in the same category