Apply Array to a new class PHP
<p>This is something that's been bugging me with PHP for a while now and I still can't figure out how I would do it. Basically at the moment for my SQL class I'm dumping the results in an array and converting them to an object to give something like this:</p>

<pre><code>$first_post = $Post-&gt;find(1);
</code></pre>

<p>(I've also been trying to get the syntax to look like: $Post::find(1); but that's a different and purely aesthetic issue altogether)</p>

<p>and then you can use first_post like so:</p>

<pre><code>$first_post-&gt;title;
</code></pre>

<p>This is done by just converting the contents of <code>$post-&gt;find(1)</code> to an object like so:</p>

<pre><code>$first_post = (object) array("title" =&gt; "blah");
</code></pre>

<p>and I know that instantiates a new STDClass but I can't figure out how to bind methods to that new instance of STDClass. It's mainly so I can do stuff like:</p>

<pre><code>$posts = $Post-&gt;all();
$last_post = $posts-&gt;last();
$specific  = $posts-&gt;find("name" =&gt; "hello");
</code></pre>

<p>Any ideas how I would get PHP to do something like this?</p>
