检查此方法是否适用于唯一ID

I'm trying to create ids to diversified contents using md5 to encode but, I'm not sure about this method.

<?php    
$prefix = 'stackoverflow';
$length = 11;
$id = md5( $prefix . uniqid(microtime()) );

$part1 = substr($id, 0,(floor($length / 2))); //First 5 chars

$id = strrev($id); //Reverse md5

$part2 = substr($id, 0,(ceil($length / 2))); //First 6 chars of the reversed md5

$final_id = $part2 . $part1; //Reverse final id
?>

You're trying to reinvent a wheel.

http://www.php.net/manual/en/function.uniqid.php

string uniqid ([ string $prefix = "" [, bool $more_entropy = false ]] )

Gets a prefixed unique identifier based on the current time in microseconds.

Also you might want to use real globally unique identifiers (windows specific extension)

http://www.php.net/manual/en/function.com-create-guid.php

The thing with random, unique ids is entropy. I.e., does it contain enough random data to be mathematically guaranteed to be unique in practice?

$id = md5( $prefix . uniqid(microtime()) );

Here, $prefix is static and adds no entropy. microtime is not random at all, and although the chance that it produces the same value twice is very low, it exists. uniqid adds a bit more entropy to that value, which is probably good enough in practice. After this you hash the value and reduce its length, which means you're removing entropy again.

Overall, you add very little entropy from the beginning and reduce some afterwards, which overall does not leave me with a good feeling. It's probably going to be good enough for a small site in practice, but I would not bet on it.

All you really need is a random number generator, which is built into your OS in almost all cases:

$id = bin2hex(file_get_contents('/dev/urandom', false, null, -1, 32));

Functions which wrap this include openssl_random_pseudo_bytes and mcrypt_create_iv. Trying to reinvent a random number generator by using some seemingly confusing string concatenation is futile, that is not true randomness (neither is /dev/urandom truly random in most cases, but it approximates it a lot better than you ever will). Depending on your situation you may also want to go with UUIDs to begin with.