Skip to content

Instantly share code, notes, and snippets.

@kawanamiyuu
Last active December 25, 2017 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawanamiyuu/51b6abc9b2a4883e66e1dd164eaff9a5 to your computer and use it in GitHub Desktop.
Save kawanamiyuu/51b6abc9b2a4883e66e1dd164eaff9a5 to your computer and use it in GitHub Desktop.
LT順をシャッフルして決め、結果を音声で発表するPHPスクリプト
#!/usr/bin/env php
<?php
$speakers = array_slice($argv, 1);
if (!$speakers) {
echo "ERROR!\n";
exit(1);
}
for ($i = 0, $len = count($speakers); $i < $len; $i++) {
// do {
usleep(100);
shuffle($speakers);
echo "shuffle!\n";
exec("say shuffle!");
}
// } while (equals(array_slice($argv, 1), $speakers));
sleep(1);
echo "\n- * - *- * - *- * - *-\n\n";
foreach ($speakers as $idx => $name) {
echo "[" . ($idx + 1) . "] " . $name . "\n";
exec("say {$name} san");
}
echo "\n- * - *- * - *- * - *-\n\n";
function equals(array $a, array $b) {
for ($i = 0; $i < count($a); $i++) {
if ($a[$i] === $b[$i]) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment