Skip to content

Instantly share code, notes, and snippets.

@blockworks
Last active November 4, 2015 23:52
Show Gist options
  • Save blockworks/1160644 to your computer and use it in GitHub Desktop.
Save blockworks/1160644 to your computer and use it in GitHub Desktop.
PHPで2つのキーワードをランダムに組み合わせる
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>2つのキーワードをランダムに組み合わせる</title>
</head>
<body>
<h1>2つのキーワードをランダムに組み合わせる</h1>
<hr />
<ol>
<?php
srand((float) microtime() * 10000000);
$kwd = array(
"あああ",
"いいい",
"ううう",
"えええ",
"おおお"
);
for($i=0 ; $i<100 ; $i++): $rand_keys = array_rand($kwd, 2);
?>
<li>「<strong><?php echo $kwd[$rand_keys[0]]; ?></strong>」と「<strong><?php echo $kwd[$rand_keys[1]]; ?></strong>」を組み合わせてみては?</li>
<?php endfor; ?>
</ol>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment