Skip to content

Instantly share code, notes, and snippets.

@prinsss
Created July 12, 2016 03:55
Show Gist options
  • Select an option

  • Save prinsss/fa70c437450e9dc9bbb84e19c5461bba to your computer and use it in GitHub Desktop.

Select an option

Save prinsss/fa70c437450e9dc9bbb84e19c5461bba to your computer and use it in GitHub Desktop.
PHP function reload example
<?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