/ LJCPHPCodeDoc / LJCCollectionLib / LJCCollectionBase / AddItem


Parameters
$item - The object to be added to the collection.
$key - The element key.

Returns

The added item.

Syntax

PHP
protected function AddItem($item, $key = null)

Adds an object and key value.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCCollectionLib.php";
 
 // Add to class that extends LJCCollectionBase
 // Adds an object and key value.
 public function AddObject(ObjectItem $item, $key = null)
 {
   if (null == $key)
   {
     $key = $item->Name;
   }
   $retValue = $this->AddItem($item, $key);
   return $retValue;
 }

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.