Re: Problem with microtime()
| From: | Rosen | Date: | Fri, 31 Aug 2001 08:18:13 +0000 |
| Subject: | Re: Problem with microtime() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65432@lists.php.net to get a copy of this message | ||
Hi,
The problem is, thath I want to generate random number between 1 and 10000
How can I do it ?
Thanks,
Rosen
"Lawrence Sheed" <Lawrence.Sheed@dfait-maeci.gc.ca> wrote in message
news:4B0FC61A2044D31180A60000F810DF207D37E5@shngir01.shngi.dfait-maeci.gc.ca
...
>
> You are casting microtimes results as an integer value. It isn't an
integer
> value, hence the 0.
>
>
> From the manual It returns the string the string "msec sec" where sec is
> the current time measured in the number of seconds since the Unix Epoch
> (0:00:00 January 1, 1970 GMT), and msec is the microseconds part. This
> function is only available on operating systems that support the
> gettimeofday() system call.
>
>
> Try:
>
> for ($i = 0; $i < 100; $i++) {
> $k = microtime();
> echo "<br>$k";
>
> for ($j = 0; $j < 10000; $j++)
> $m = $j *3;
> }
>
> Or look in the http://www.php.net/manual/en/function.microtime.php‰ŽÄ²332â©!è
> þÊY for
> examples.
>
> -----Original Message-----
> From: Rosen [mailto:rosen_dm@dir.bg]
> Sent: August 31, 2001 3:29 PM
> To: php-general@lists.php.net
> Subject: [PHP] Problem with microtime()
>
>
> Hi,
> I'm using the following code:
> for ($i = 0; $i < 100; $i++) {
> $k = (int) microtime();
> echo "<br>$k";
>
> for ($j = 0; $j < 10000; $j++)
> $m = $j *3;
> }
>
>
> but it prints me only "0......"
>
>
>
> Where can be problem ?
>
>
>
> Thanks,
>
> Rosen
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net