PHP Magic Methods Program (4)
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 | |
class Dog { | |
private $name; | |
public function __construct($name) { | |
echo "object constructed! <br>"; | |
$this->name = $name; | |
} | |
public function bark() { | |
echo "Bark! <br >"; | |
} | |
public function __destruct() { | |
echo "object destructed! <br>"; | |
} | |
} | |
$dog = new Dog("Arnold"); | |
$dog->bark(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment