<?php
class Book {
  private $_title;

  function __get($key){
    if (method_exists($this, $method = 'get' . ucfirst($key)))
      return $this->$method();
  }

  function __set($key, $value){
    if (method_exists($this, $method = 'set' . ucfirst($key)))
      return $this->$method($value);
  }

  private function getTitle(){
    return $this->_title;
  }

  private function setTitle($value){
    $this->_title = $value;
  }
}

$book = new Book();
$book->title = 'Code Complete';
echo $book->title;
