Skip to content

Instantly share code, notes, and snippets.

@myanmarlinks
Created July 9, 2017 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myanmarlinks/9bfe0597d6dab7cf221e42ea8d4ff065 to your computer and use it in GitHub Desktop.
Save myanmarlinks/9bfe0597d6dab7cf221e42ea8d4ff065 to your computer and use it in GitHub Desktop.
PHP Magic Methods Program (4)
<?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