Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$hellos = ['hi', 'hey'];
$separators = [
' ',
', ',
' - ',
'... ',
'.. ',
];
$questions = [
'will you be at',
'will you be coming to',
'will you make',
'can you make',
'can you come to',
'can you make it to',
'do you fancy coming to',
'do you think you\'ll be at',
'reckon you\'ll be down for',
'reckon you\'ll be at',
];
$eventNames = [
'PHP Hampshire',
'PHP Hants',
];
$dates = [
'on Weds?',
'on Weds? :)',
// 'tomorrow?',
// 'tomorrow? :)',
];
$link = 'phphants.co.uk/meetups';
$receipientsRaw = "
@asgrim James
@phphants PHPHants
";
$receipients = explode("\n", $receipientsRaw);
foreach ($receipients as $receipient) {
if (empty($receipient)) continue;
list($twitter, $name) = explode("\t", $receipient);
$tweet = $twitter . ' ';
$tweet .= $hellos[mt_rand(0, count($hellos)-1)] . ' ';
$tweet .= $name;
$tweet .= $separators[mt_rand(0, count($separators)-1)];
$tweet .= $questions[mt_rand(0, count($questions)-1)] . ' ';
$tweet .= $eventNames[mt_rand(0, count($eventNames)-1)] . ' ';
$tweet .= $dates[mt_rand(0, count($dates)-1)] . ' ';
$tweet .= $link;
if (strlen($tweet) > 140) {
die("ERROR: Tweet to $twitter was > 140 characters.\n");
}
echo $tweet . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment