demos/hangman/protected/controllers/GameController.php
protected function generateWord()
	{
		$wordFile=dirname(__FILE__).'/words.txt';
		$words=preg_split("/[\s,]+/",file_get_contents($wordFile));
		do
		{
			$i=rand(0,count($words)-1);
			$word=$words[$i];
		} while(strlen($word)<5 || !ctype_alpha($word));
		return strtoupper($word);
	}
protected function generateWord()
	{
		$wordFile=dirname(__FILE__).'/words.txt';
		$words=preg_split("/[\s,]+/",file_get_contents($wordFile));
		do
		{
			$i=rand(0,count($words)-1);
			$word=$words[$i];
		} while(strlen($word)<5 || !ctype_alpha($word));
		return strtoupper($word);
	}
protected function generateWord ( ) { $ wordFile = dirname ( __FILE__ ) . '/words.txt' ; $ words = preg_split ( "/[\s,]+/" , file_get_contents ( $ wordFile ) ) ; do { $ i = rand ( 0 , count ( $ words ) - 1 ) ; $ word = $ words [ $ i ] ; } while ( strlen ( $ word ) < 5 || ! ctype_alpha ( $ word ) ) ; return strtoupper ( $ word ) ; }
Generates a word to be guessed.
@return string the word to be guessed
Generates a word to be guessed .