Search code examples
phplaraveluniquelaravel-6

Can the length of current Unix timestamp greater then 10 Digits


My Question Is :

Is The time() [10 Digits Number (Seconds)] can Be Increased to 11 or 12 digits ?

The Purpose of Asking This Question is I am creating A uniq transaction id depending on that and with some other variable.. I have to maintain a Length of 18 Digits (Numbers only)

Edit : Note I dont want to make it longer.. As it increases to 11/12 digits i have to make the rest 7/8 digits dynamically .. Because i am using 2 randomiser for that last 7/8 digits

Edit2: Will it make sense => rand(8 Digits) vs rand(3) + rand(3) + rand(2) For Collision Purpose ??


Solution

  • If you run date() with a time parameter containing the first 11 digit time you will see that you will not get 11 digits in a time() until

    echo date('d/m/Y H:i:s', 10000000000);
    

    RESULT

    20/11/2286 17:46:40
    

    If you think that your App will be running after that date you should worry about this situation, otherwise you dont need to worry or code for it.

    PS I doubt PHP will exist or Intel come to that in 2286 :)