Login   Register  
PHP Classes
elePHPant
Icontem

File: usage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Hasin Hayder  >  PHP Collection  >  usage.php  >  Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Example Script using this Class
Class: PHP Collection
Manipulate collection objects indexed by names
Author: By
Last change: Commemnts added
Date: 9 years ago
Size: 721 bytes
 

Contents

Class file image Download
<?
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);

?>