PHP passing a class name becomes a string when passed to a function
<p>Here's what I want to do:</p>

<pre><code>public function all($model) {
  $query = 'SELECT ' . implode(', ', $model::$fields) ....;
}
</code></pre>

<p>Called like this:</p>

<pre><code>$thing-&gt;all(Account);
</code></pre>

<p>I get this error:</p>

<pre><code>Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/mark/public_html/*/account.php on line 15
</code></pre>

<p>When inspecting <code>$model</code> with <code>var_dump</code> it turns out its a string. In the the first example if I change <code>$model</code> to <code>Account</code> on the $query line it works fine.</p>

<p>How can a take a string and turn it back into a class?</p>

<p>Edit: Updated example and title to reflect the problem isn't with <code>self</code>.</p>

<p>Solution: Since I'm not using PHP5.3, I had to resort to using eval() to get what I wanted. Thanks everybody!</p>
