how to make a Random script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tsalexey544
Forum Commoner
Posts: 41
Joined: Thu Jun 22, 2006 11:19 am

how to make a Random script?

Post by tsalexey544 »

How can I make a PHP script that will choose HTML script randomly or something like that. I want to make it so it will choose 3-4 ramndom squares. Each square has it's image and a text. The squares should be displaid on one line.

Can I just use php for that?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Run that by us again!? :? 8O
tsalexey544
Forum Commoner
Posts: 41
Joined: Thu Jun 22, 2006 11:19 am

Post by tsalexey544 »

How to make a random script?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Random script? That's easy:

Code: Select all

cat /dev/urandom > script.php
:D

tsalexey544, you'd better try to explain what you're after in more words. Heuristics fails on short sentences.
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: how to make a Random script?

Post by aerodromoi »

tsalexey544 wrote:How can I make a PHP script that will choose HTML script randomly or something like that. I want to make it so it will choose 3-4 ramndom squares. Each square has it's image and a text. The squares should be displaid on one line.

Can I just use php for that?
What's a square? ;)
An image created on the fly, a "regular" image, a rectangular div?

You might want to take a look at: http://de3.php.net/manual/en/function.rand.php

aerodromoi
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Are you pulling from a database, or is what you are going to display going to be generated code-side? Or is the data already stored in an array? Give more details.
Post Reply