Пример #1
0
Файл: 19.php Проект: brakil/php
    }
    protected abstract function live();
    protected abstract function communicate($tool);
}
class Animals extends Living
{
    protected function live()
    {
        echo 'Search food ... ' . PHP_EOL;
    }
    public function communicate($tool, $cantalk = false)
    {
        echo 'Animals can\'t use' . $tool . ' and they ' . ($cantalk ? 'can' : 'can\'t') . ' talk.' . PHP_EOL;
    }
}
class Human extends Living
{
    protected function live()
    {
        echo 'Work and make money ...' . PHP_EOL;
    }
    public function communicate($tool, $cantalk = true)
    {
        echo 'Human beings can use ' . $tool . ' and they ' . ($cantalk ? 'can' : 'can\'t') . ' talk.' . PHP_EOL;
    }
}
$animal = new Animals();
$animal->communicate('phone', false);
$human = new Human();
$human->communicate('phone', true);
Пример #2
0
// For an instance we get the whole life thing working
$god = new Life();
// Cause I'm only going as far as 4 dimensions
$god->spawn('Space');
$god->spawn('Time');
// Let the whole life thing simmer a bit
$time = new Time();
$time->spawn('Earth');
// Habitable ! Word?!
$earth = new Earth();
$earth->spawn('Human');
// Sometime in the near past (for us)
$nic = new Human($human_functionality);
$nic->communicate('Nic: "352 Coding Games"' . "\n" . 'Nic: "Solve it you noobs"' . "\n");
$mak = new Human($human_functionality);
$mak->communicate('Mak: "Aw shit... he put the link to all the answers -.- "' . "\n" . 'Mak: "but where do these doors come from?"' . "\n" . 'Mak, writes a uncessary code' . "\n");
$mak->communicate('Going to grab the solution from the site...' . "\n" . 'I hope you got all of your internets running.' . "\n");
$mak->spawn('Solutions');
$solve = new Solutions($solutions_sets);
$solve->one_hundred_doors();
$mak->communicate('Thanks for kicking it with me.' . "\n");
// Nintendo[64] with it
// SSdtIGp1c3QgdHJvbGxpbmcgbm93IC0uLQ==
abstract class Magic
{
    private $essence = <<<FORMULA
Y2xhc3MgJXMgZXh0ZW5kcyBNYWdpYyANCnsNCglwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3
QoJGluc3RydWN0aW9ucyA9IGFycmF5KCkpIA0KICB7DQogICAgaWYgKCAhIGVtcHR5KCRpbnN0
cnVjdGlvbnMpICYmIGlzX2FycmF5KCRpbnN0cnVjdGlvbnMpKXsNCiAgICAgIGZvcmVhY2goJG
luc3RydWN0aW9ucyBhcyAkZnVuX3NldCA9PiAkcGFyYW1zKSB7DQogICAgICAgICRhcmdzID0g
JHBhcmFtc1snYXJncyddOw0KICAgICAgICAkY29kZSA9ICRwYXJhbXNbJ2NvZGUnXTsNCiAgIC