Basic PHP collection
<p>I have an entry that could have several comments associated with that entry.</p>

<p>If I were doing this in C# I would build a collection of these comments.  However, I'm unfamiliar with a way to do this in PHP.</p>

<p>My current thought process is to have a comment object that has a method that would build and data_array based off of IDs and then just call that object and utilize the data that way.</p>

<p>Is that the easiest most basic way of doing that?  Or is there a better (right way) of building a collection for PHP?</p>

<p><strong>My pseudo code:</strong></p>

<pre><code>class entry
var $id
var $text


class comments
var $id
var $entryId
var $text
var $data_array;

function getCollectionById(){
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $da[$i] = array('entryId'=&gt;$row["entryId"],'text'=&gt;$text);
    }
    $this-&gt;data_array = $da;
}
</code></pre>
