• 0

[PHP] Multiple Random Values, on Same Request


Question

I have a Web Application that is running a custom REST Server. Every API request gets passed through this server. With that being said, when I refresh a page on my Web Application 5 simultaneous AJAX requests are being made. I noticed when I call something like a date(), time(), microtime() or rand(), they all return the same value for EACH request for "Random".

 

For example, here's the code that is being executed:

 

echo 'RANDOM!: ' . rand(5, 10000);

die;

 

Here's the response:

 

Response -> RANDOM!: 4288

Response -> RANDOM!: 4288

Response -> RANDOM!: 4288

Response -> RANDOM!: 4288

Response -> RANDOM!: 4288

 

To clarify again, each request above is an AJAX call. I've never really encountered an issue like this before. Also, adding sleep() didn't have any affect. Can anyone help?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.