$map[$key]=$value; // add a key-value pair
unset($map[$key]); // remove the value with the specified key
if(isset($map[$key])) // if the map contains the key
foreach($map as $key=>$value) // traverse the items in the map
$n=count($map); // returns the number of items in the map
ファイルを表示
Open project: pradosoft/prado
Class Usage Examples
Method | Description | |
---|---|---|
__construct ( $data = null, $readOnly = false ) | Constructor. | |
add ( $key, $value ) | Adds an item into the map. | |
clear ( ) | Removes all items in the map. | |
contains ( $key ) : boolean | ||
copyFrom ( $data ) | Copies iterable data into the map. | |
count ( ) : integer | Returns the number of items in the map. | |
getCount ( ) : integer | ||
getIterator ( ) : Iterator | Returns an iterator for traversing the items in the list. | |
getKeys ( ) : array | ||
getReadOnly ( ) : boolean | ||
itemAt ( $key ) : mixed | Returns the item with the specified key. | |
mergeWith ( $data ) | Merges iterable data into the map. | |
offsetExists ( $offset ) : boolean | Returns whether there is an element at the specified offset. | |
offsetGet ( $offset ) : mixed | Returns the element at the specified offset. | |
offsetSet ( $offset, $item ) | Sets the element at the specified offset. | |
offsetUnset ( $offset ) | Unsets the element at the specified offset. | |
remove ( $key ) : mixed | Removes an item from the map by its key. | |
toArray ( ) : array |
Method | Description | |
---|---|---|
_getZappableSleepProps ( &$exprops ) | Returns an array with the names of all variables of this object that should NOT be serialized because their value is the default one or useless to be cached for the next page loads. | |
setReadOnly ( $value ) |
public __construct ( $data = null, $readOnly = false ) |
protected _getZappableSleepProps ( &$exprops ) |
public add ( $key, $value ) |
public copyFrom ( $data ) |
public getIterator ( ) : Iterator | ||
return | Iterator | an iterator for traversing the items in the list. |
public getReadOnly ( ) : boolean | ||
return | boolean | whether this map is read-only or not. Defaults to false. |
public mergeWith ( $data ) |
public offsetExists ( $offset ) : boolean | ||
return | boolean |
public offsetSet ( $offset, $item ) |
public offsetUnset ( $offset ) |