Created
December 8, 2014 07:30
-
-
Save abahler/a3286d5d4baccf4d747d to your computer and use it in GitHub Desktop.
T-Swift's hit song, in PHP form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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