|
|
|
U will get 3 example scripts
1. example_no_object.php - for string, numerical information
2. example_only_object.php - for Object storing
3. example_object_with_none_object.php - for normal value with user defined object.
| <?php
/* PHP Collection class */
require 'base.class.php';
require 'collection.class.php';
/* Create Collection Object */
$coll=new Collection();
/* my object */
class MyObject extends Base {
var $value;
var $name;
function MyObject($name,$v) {
$this->name=$name;
$this->value=$v;
}
function getAmount() {
return $this->value;
}
function getName() {
return $this->name;
}
}
/* add to collection */
// none object
$coll->add("Hasan");
$coll->add("Tanveer");
$coll->add("Hossain");
// object
$coll->add(new MyObject("hasan","121.21"));
$coll->add(new MyObject("khan","32.11"));
/* iterate */
$it=$coll->iterator();
/* check */
while($it->hasNext()) {
/* get Object */
$getObj=$it->next();
if(!($getObj instanceof MyObject)) {
/* get value */
$getValue=$getObj->getValue();
/* print out */
echo "my value: ".$getValue."<br />";
}
else {
$getName=$getObj->getName();
$getAmount=$getObj->getAmount();
/* print out */
echo "Name: $getName, Amount: $getAmount<br />\r\n";
}
}
?> | | |
|
| very simple ftp class Categories : PHP, PHP Classes, FTP | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | A Timing Class Categories : PHP, PHP Classes, Date Time | | | The class to check load time of your script
VERY usefull for relatively slow applications, but not only.. Categories : PHP, PHP Classes, Debugging | | | Create HTML forms dynamicly using Javascript & PHP Categories : PHP, PHP Classes, Java Script | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | RSS parser.
Parses RSS into an array. Quick and nasty but does the job.
No checking is done for correct Tags, only correct XML.
PHP4 needed to display result (uses print_r). Categories : PHP, XML, PHP Classes, Rich Site Summary (RSS) | | | These PHP Classes Check if a host is alive using various methods. Categories : PHP, PHP Classes, Sockets, CURL | | | an example of the cyberlib payment class Categories : PHP, PHP Classes, Ecommerce, Credit Cards | | | Power Form Validation Categories : PHP, PHP Classes, Data Validation | | | MySQL Handler Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes | | | pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes | | | Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip Categories : Email, Network, PHP, PHP Classes | | | A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function. Categories : PHP, PHP Classes, Calendar, Date Time | | | Browser Detecor Class Categories : PHP Classes, PHP, HTML | |
|
|
|