randomservermicrotime

Can $_SERVER["REMOTE_PORT"] be repeated for more than one device at the same time


I try to make function that generate random id using $_SERVER["REMOTE_PORT"] and microtime() , so i ask if if $_SERVER["REMOTE_PORT"] Can be repeated for more than one device at the same time


Solution

  • The repeating can occurs if some cases like:

    In general it's quite rarely to have this issue, you also can use microtime(false) to get more decimal points for microtime functions, Also I recommend to view mt_rand function to generate fast random numbers.