cturner Posted September 5, 2008 Share Posted September 5, 2008 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 More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 $testimonial = array("testmonial1","testmonial2","testmonial3","testmonial4"); $rnd = rand(0, 3); print $testimonial[$rnd]; Link to comment https://forums.phpfreaks.com/topic/122847-random-multi-array/#findComment-634432 Share on other sites More sharing options...
cturner Posted September 6, 2008 Author Share Posted September 6, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.