Created
July 12, 2016 03:55
-
-
Save prinsss/fa70c437450e9dc9bbb84e19c5461bba to your computer and use it in GitHub Desktop.
PHP function reload example
This file contains hidden or 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 | |
| class Shit | |
| { | |
| /** | |
| * Function reload | |
| */ | |
| public static function fuck() | |
| { | |
| $args = func_get_args(); | |
| if (count($args) == 1) { | |
| self::fuckMultiple($args[0]); | |
| } elseif(count($args) == 2) { | |
| self::fuckSingle($args[0], $args[1]); | |
| } | |
| } | |
| private static function fuckMultiple(Array $humans) | |
| { | |
| foreach ($humans as $human) { | |
| self::fuckSingle($human['name'], $human['sex']); | |
| } | |
| } | |
| private static function fuckSingle($name, $sex) | |
| { | |
| if (is_string($name) && is_bool($sex)) | |
| echo ($sex ? "$name, boy♂next♂door" : "$name, my little baby~")."<br />"; | |
| else | |
| echo "Invalid parameters."; | |
| } | |
| } | |
| echo Shit::fuck(Array( | |
| ['name' => 'sabi', 'sex' => true], | |
| ['name' => 'maki', 'sex' => false] | |
| )); | |
| echo Shit::fuck('jack', true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment