php3-list | 199901
Date: 01/31/99
- Next message: Luke Welling: "Re: [PHP3] strange problem with rand()"
- Previous message: Mark Musone: "Re: [PHP3] strange problem with rand()"
- In reply to: Mark Musone: "Re: [PHP3] strange problem with rand()"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] strange problem with rand()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jan 29, 1999 at 03:13:23AM +0926, Mark Musone wrote:
> it could be php not liking a reserved (?) name as a variable.
>
> count() is a function.
>
> you're using $count..
>
> try changing $count to something else..
>
> Mark
>
> >
> > hi all,
> >
> > I am using PHP on FreeBSD (i am a Pair networks client)
> > and i have a strange problem, look at this:
> >
> > $images = array("batman","indian","mermaid");
> > /* images array made shorter, doesn't seem to make a difference to me */
> > $count = count($images);
> > srand((double)microtime()*1000000); //seeding the random generator
> > $i=rand(0,$count); //picking a value between 0 and the length of $images
> >
> > ----
> >
> > After this I just do something like:
> > <img src="<? print $images[i]; ?>.gif"
That should be $images[$i].
> > After this a random image from the array should appear. But all i get is
> > HUGE values for $i like 1543769270 or 470447945 (i know this because
> > I print $i in my php3 file)... Anybody know
> > what's going on?
Hmm.. 'man perlfunc' has a warning about that. Maybe it applies to PHP too?
Greetz, Peter.
-- .| Peter van Dijk .| peter <email protected>-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Luke Welling: "Re: [PHP3] strange problem with rand()"
- Previous message: Mark Musone: "Re: [PHP3] strange problem with rand()"
- In reply to: Mark Musone: "Re: [PHP3] strange problem with rand()"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] strange problem with rand()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

