|
|
|
|
![]() ![]() |
Jan 29 2008, 09:00 PM
Post
#11
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 528 Joined: 13-October 06 From: Alberta, Canada Member No.: 31,584 |
Oh yeah.... I just remembered..... you can also do this with switches... or cases whatever they're called.
CODE $random_message = rand(1, 6);
switch ($random_message) { case 1; $rand = 'BLA BLA BLA BLA BLA.... '; break; case 2; $rand = 'BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... '; break; case 3; $rand = 'BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... '; break; case 4; $rand = 'BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... '; break; case 5; $rand = 'BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... '; break; case 6; $rand = 'BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... BLA BLA BLA BLA BLA.... '; break; } echo $rand; |
|
|
|
Jan 30 2008, 03:09 AM
Post
#12
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 150 Joined: 9-April 07 From: Nebraska Member No.: 41,301 |
There are a lot of tutorials on how to randomize things with php.
Why do they need so many? Why couldn't someone just post a couple of the functions like random(), and a tutorial on arrays, and let people figure out, "Hey, maybe if I put a random number in an array of strings, I could have it use that as the title, then I would have a random title!" There have been tutorials on having random images, and random titles, and many others, and they're all pretty much exactly the same. To me, it just seems like wasted space, and when you're trying to actually figure something out, you have a lot more code to look through because of all the ways people find to do the same thing. They should only make a new post if it's actually new code, or it's really innovative, and not something someone could easily figure out. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 28th August 2008 - 10:11 AM |