mardi 24 novembre 2020

PHP random number update (loto)

Good day everyone,

First I want to apologize but I couldnt find any solution or question on stackoverflow. Im not php coder but I need to make random namber generator on localhost, which I made easily by mt_rand function, it is in loop where it shows every 0.1 sec another rand number with usleep (it goes 50 times), but it is generating numbers next to each other.

What I want is, it should change only one number on screen, so there will be in the middle of the screen one number randomized and every 0.1 sec changing so it will look like random loto. So is there a function that can update or clear old number and show in its place another for every iteration ?

And of course I want to stay with easiest possible code. So my old code for random number is here:

for( $i = 0 ; $i < 50 ; $i++ )
        {
          echo mt_rand(0, 30) . ' ';
          flush();
          ob_flush();
          usleep(100000);
        }



Aucun commentaire:

Enregistrer un commentaire