<?
include_once("collection.php");
$col = new phpCollection();
$col2 = new phpCollection();
$col->add("a","123"); //add an object
$col->add("b","13"); //add an object
$col->add("c","134"); //add an object
$col2->add("ba","Ayesha"); //add an object
$col2->add("ca","Hasin"); //add an object
$col->add("d",$col2); //add col2 object to col collection
$col->rewind(); //set iterator position to 0
echo "<br>"."Item : ".$col->current(); //retrieve current element
while ($col->has_next()) //iterates
{
echo "<br>"."Item : ".$col->current(); //retrieve current element
}
echo "<hr>";
$ncol = $col->item("d"); //retrieve object
$ncol->rewind(); //use that object
echo $ncol->itemat(0);
?>
|