[Solved] Reset While loop value in PHP


Try use jquery, the below example is for random numbers.

<script>

    var id = window.setInterval(function(){randomNumber();},1000);

    function randomNumber()
    {
        var rand = Math.floor(Math.random()*6);
        //Do whatever you want with that number
        $('#holder').html(rand);
    }

</script>



<!DOCTYPE html>
<html>
<head>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <meta charset=utf-8 />
    <title>Random Number</title>
</head>
<body>
<div id='holder'></div>
</body>
</html>

For random text

var names = ['test1', 'test2', 'test3', 'test4'];

setInterval(function() {
  var rand = Math.floor(Math.random() * 4);
  document.getElementById("name").innerHTML = names[rand];
}, 2000);

<div id="name">test</div>

solved Reset While loop value in PHP