Created
May 25, 2011 05:31
-
-
Save tw2113/990405 to your computer and use it in GitHub Desktop.
Macho Man Randy Savage
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 //RIP Randall Mario Poffo | |
function macho_man_randy_savage() { | |
static $elbow_drops = 3; | |
if(!$elbow_drops) return 'oooooooooooooooohhhhhhhhhhhhhhhh yeeeeeeeeeeeeeeeeaaaaaaaahhhhhh'; | |
$elbow_drops--; | |
} | |
//will show phrase on 4th call and every call after. | |
echo macho_man_randy_savage(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep. If you want it to show phrase on 3rd call, move the -- statement or start elbow_drops at 2.
Or, if you want more flexibility, you could have an optional argument that defaults to the starting amount, like this:
function slim_jim($total = 3) {
static $elbow_drops = $total;
// the rest
}
Then, you can call it as in the gist to start it at 3, or you could call slim_jim(10) to start it at 10.