Created
January 2, 2012 23:18
-
-
Save h2rd/1552578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UniqId { | |
public static function get() { | |
static $db = null; | |
if ( $db == null ) { | |
$db = new UniqId(); | |
} | |
return $db; | |
} | |
private $_handle = null; | |
private function __construct() { | |
$this->_handle = uniqid(); | |
} | |
public function handle() { | |
return $this->_handle; | |
} | |
} | |
print( "UniqId = " . UniqId::get()->handle() . "\n" ); | |
print( "UniqId = " . UniqId::get()->handle() . "\n" ); | |
print( "UniqId = " . UniqId::get()->handle() . "\n" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment