OO PHP Question
<p>I'm very new to PHP and I'm currently working my way through this book:
<a href="http://rads.stackoverflow.com/amzn/click/0672329166" rel="nofollow">http://www.amazon.co.uk/PHP-MySQL-Development-Developers-Library/dp/0672329166</a></p>

<p>So I'm at Chapter 6: Object-oriented PHP and I'm finding this topic really difficult to comprehend.</p>

<p>Firstly, what does</p>

<pre><code>    public function __set($name, $value)
{
    $this-&gt;$name = $value;
}
</code></pre>

<p>do? Same goes for __get.</p>

<p>After reading most of the chapter and not really understanding it, I thought I'd try and implement classes and objects in my site so I could maybe understand through experimentation.</p>

<p>I haven't gotten very far :D</p>

<p>Here's what I've got (class_lib.php):</p>

<pre><code>&lt;?php
class Page
{
    public $header = "&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n
    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"&gt;\n
    &lt;html xmlns=\"http://www.w3.org/1999/xhtml\"&gt;\n
    &lt;head&gt;\n
    &lt;meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /&gt;";

    public function __set($name, $value)
    {
        $this-&gt;$name = $value;
    }

    public function Display() {
    $this -&gt; DisplayHeader();
    }

    public DisplayHeader() {
    echo $this-&gt;header;
    }
}
</code></pre>

<p>?></p>

<p>And (index.php):</p>

<pre><code>&lt;?php

require("class_lib.php");

$class = new Page();

$class-&gt;Display();
</code></pre>

<p>?></p>

<p>The error I get when I load the file in Google Chrome is:</p>

<blockquote>
  <p>Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in C:\wamp\www\PS v3 (PHP)\class_lib.php on line 15</p>
</blockquote>

<p>I suppose if I knew what __set meant, I might have stood a chance at figuring that part out.</p>

<p>Any answers / advice would be massively appreciated :)</p>
