Skip to content

Instantly share code, notes, and snippets.

@varemenos
Created May 16, 2013 00:24
Show Gist options
  • Save varemenos/5588524 to your computer and use it in GitHub Desktop.
Save varemenos/5588524 to your computer and use it in GitHub Desktop.
PHP - Basic OOP
<?
class entry{
private $id = -1; // required
private $title = ""; // required
private $author = -1; // required, author ID
private $excerpt = ""; // either turn title into excerpt or manually enter one
private $date = ""; // required
// #TODO
// post type interface?
// private $type = "";
public function __get($property) {
if (property_exists($this, $property)) {
return $this->$property;
}
}
public function __set($property, $value) {
if (property_exists($this, $property)) {
$this->$property = $value;
}
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment