View Full Version : php random
themoose
November 28th, 2005, 07:26
How can I get a php script to randomise from a previously-selected selection of words? Thanks,
tm
Tree
November 28th, 2005, 09:39
Are those words in a database or an array?
themoose
November 28th, 2005, 09:39
array.
themoose
November 28th, 2005, 10:17
Oh, and it has to output the randomly generated word as a fixed variable.
themoose
November 28th, 2005, 10:33
nvm ive got it
<?php
$value = array("Rabin","Reid","Cris","KVJ","John");
$rand_keys=array_rand($value,2);
echo "First random element = ".$value[$rand_keys[0]];
Tree
November 28th, 2005, 18:34
What are you using this for, might I ask?
robert allen
November 29th, 2005, 08:41
T.M, remember that scirpt you made for swed.us/randomgame.php. Use that one, but change all the swf to txt and then put all the quotes in seperate txt files in one of the directrys. Simple.
themoose
November 29th, 2005, 12:27
robertallen, that would be a waste of time as this one works :)
Tree, i am using it for displaying random images on my portfolio home :)
Tree
November 29th, 2005, 14:43
Cool. Yeah, your script would work just fine.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.