You are here: Microsecond Help - Beginner « PHP Programming Language « IT news, forums, messages
Microsecond Help - Beginner

Posted by Kevin Cloutier on 12/08/23 11:28

Hi,

I'm am brand new to PHP and I'm getting up to speed (slowly) running
through some example tutorials. But I am having trouble getting a For
Loop to work.

It is supposed to return the microscond from the server each time it
loops, but it is returning the same second each time through. I'm
assuming this is because "function make_seed()" is declared outside of
the loop, but I'm stuck on how to rectify this.

Below is my code, any help would be appreciated!

Kevin

------------------------------------------
<html>
<?
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randvalue = rand(1,100);

?>
<ul>
<?
for ($i = 1; $i<10; $i++){ ?>
<li><strong><?= $randvalue ?></strong></li>
<?}?>
</ul>
</html>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация