Skip to content

Instantly share code, notes, and snippets.

@abahler
Created December 8, 2014 07:30
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 abahler/a3286d5d4baccf4d747d to your computer and use it in GitHub Desktop.
Save abahler/a3286d5d4baccf4d747d to your computer and use it in GitHub Desktop.
T-Swift's hit song, in PHP form.
<?php
// Run this script from your terminal whenever the haters got you down.
$negativity = array(
"players" => "play",
"haters" => "hate",
"Heart-breakers" => "break",
"fakers" => "fake"
);
// Start building the chorus
$chorus = "'Cause the ";
foreach ($negativity as $group => $verb) {
if ($group == "players") {
$chorus .= "$group gonna ";
for ($i = 0; $i < 5; $i++) {
$chorus .= "$verb, ";
}
$chorus = rtrim($chorus, ", ") . "\n";
} else if ($group == "haters") {
$chorus .= "And the $group gonna ";
for ($i = 0; $i < 5; $i++) {
$chorus .= "$verb, ";
}
$chorus = rtrim($chorus, ", ") . "\n";
} else {
break;
}
}
$shake_off = "Baby, I'm just gonna shake, shake, shake, shake, shake\n";
$shake_off .= "I shake it off, shake it off.\n";
$chorus .= $shake_off;
// Second part of chorus
foreach ($negativity as $group => $verb) {
if ($group == "Heart-breakers") {
$chorus .= "$group gonna ";
for ($i = 0; $i < 5; $i++) {
$chorus .= "$verb, ";
}
$chorus = rtrim($chorus, ", ") . "\n";
} else if ($group == "fakers") {
$chorus .= "And the $group gonna ";
for ($i = 0; $i < 5; $i++) {
$chorus .= "$verb, ";
}
$chorus = rtrim($chorus, ", ") . "\n";
} else {
next($negativity);
}
}
$chorus .= $shake_off;
echo $chorus;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment