tryphp_keyword_interface.php:
isOn = true; } public function deactivate() { $this->isOn = false; } public function isActive() { return $this->isOn; } } $machine = new Kettle(); $machine->activate(); if($machine->isActive()) { echo "The machine is on"; } else { echo "The machine is off"; } echo "
"; $machine->deactivate(); if($machine->isActive()) { echo "The machine is on"; } else { echo "The machine is off"; } ?>
The machine is on
The machine is off