mardi 12 juillet 2016

Random numbers not changing

I have written a simple page to test a problem with another part of a site I am developing.

Basically, variables are getting stuck for lack of a better term on certain systems. I have inserted the following code into a wordpress page.

echo 'Current PHP version: ' . phpversion() . '<br>';
$timestamp = time();
$current_time = date('h:i:s');
echo 'Timestamp: ' . $timestamp . '<br /> Current Time: ' . $current_time . '<br />' ;
$randomA=mt_rand(1000,3000);
echo 'Random Number: '. $randomA . '<BR />' ;

This displays information of 3 different items that should change every time the page is loaded.

My problem is that systems on different places/isps/platforms are getting the same numbers every time the page loads.

If I load this page in chrome, safari or firefox on my mac I am getting an expected response. If I attempt to load the page on my iPhone on the same wifi network as the mac, I always get the same numbers.

I have also tested the same code in a quick page on a separate server. This other server always gives expected results on all devices.

I have attempted using unset and that did not work.




Aucun commentaire:

Enregistrer un commentaire