Jump to content

Random multi array


cturner

Recommended Posts

I am wondering if someone could please tell me, how I can have a random multi array? This is an example of what I am after:

Testimonial here

Company Name here.

The above must be randomly selected from an array. I will have at least 8 testimonails with company names to display, more maybe added later. I have no idea where to start with this. Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/122847-random-multi-array/
Share on other sites

I have tried your code, ranjuvs and have edited your code to suit what I am after, now it is coming up with a blank page. Here is the code which I have edited:

$testimonial  = array("testmonial1" => "companyname1","testmonial2" => "companyname2","testmonial3" => "companyname3","testmonial4" => "companyname4");

$rnd = rand(0, 3);
print $testimonial[$rnd][$rnd];

 

I wanting to display the testimonial then the company name, because I am needing to make the company name a different colour to the testimonial. Could someone please tell me how I can get pass the blank page thing, and change the colour of the company name?

Link to comment
https://forums.phpfreaks.com/topic/122847-random-multi-array/#findComment-634992
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.