Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:39:11+00:00 2026-06-11T13:39:11+00:00

I have to generate unique ID depending on time, counter and random prepended value

  • 0

I have to generate unique ID depending on time, counter and random prepended value from 1 to 10. The way I generate it:

$time = (int)(time()+$i);
$time = $time.(rand(1,9));
//At this step we have strings looking like this:
"13480835672" //This is time in first iteration
"13480835672" //This is time in second iteration
//But if I convert it to int 
$time = (int)$time;
2147483647 //This is time converted in first iteration
2147483647 //This is time converted in second iteration

As you can see above times are same. All of them. What Am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:39:13+00:00Added an answer on June 11, 2026 at 1:39 pm

    2147483647 is the maximum (signed) integer number your operating system / php binary can work with.

    2147483647*2 = 2^32 which means your operating system / php binary is working 32 bits.

    In the above explanation I’m multiplying by two because the integers used by php are signed which means they span both on the negative and the positive axis of integer numbers.

    Using a float value such as one returned by microtime(TRUE) allows you to work with much bigger numbers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this class (taken from a blog tutorial) to generate unique keys to
i'm trying to generate a unique id using this code: $RCode = md5(uniqid(rand(), true));
I have an object for which I want to generate a unique hash (override
I have to generate an executable (.exe) file from my python program. I would
On a datawarehouse project with SSIS/SSAS, I have to generate my own time dimension
What java library are there provides the the facility to generate unique random string
I need to generate a unique integer id for a string. Reason: I have
I have implemented an algorithm that will generate unique names for files that will
I want to generate unique and random numbers or IDs which I can use
I'm wondering what is the best way to display unique records from a has_many,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.