Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (3) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2015-06-17 (1 year ago) | Not yet rated by the users | Total: 114 This week: 1 | All time: 8,401 This week: 1,047 |
Version | License | PHP version | Categories | |||
aliased-array 15.6.8 | MIT/X Consortium ... | 5.0 | PHP 5, Data types |
Description | Author | |||
This class can assign array entries that point to other entries. Innovation Award
|
* Extends ArrayObject to implement a aliased key array. Allows for any number of * unique keys (alias keys) pointing to an array element. * * CAUTION: This will not handle multi-dimension arrays like you can't * do this: * * $a = new AliasedArray(); * $a[1][2] = 25; * * This will not work and will not generate an error. * * To add an element you first have to add an indexed data element * * $a = new AliasedArray(); * $a->set(key, data); * $a[key] = data; * * You can also add an existing array: * * $a = new AliasedArray($existingArray); * * After an element has been added you can add an alias for the key. The * alias is not allowed to match a key. * * $a->alias(key, alias); * * The following would throw an exception: * * $a->set('a', 10); * $a->set('b', 20); * $a->alias('a', 'b'); * * because the alias 'a' is already used as a key. * If the key does not exist, an exception will be thrown. * So for example these will work: * * $a->set(1, 'thedata'); * $a->alias(1, 'theabc'); * or * $a['key1'] = 'newdata'; * $a->alias('key1', 'alias1'); * * To get the data * * $a->get(1); // returns 'thedata' * $a[1]; // ditto * $a['key1']; // returns 'newdata' * $a['alias1']; // ditto * * if the element for the key or the index does not exist then a * NULL will be returned. You can unset key and alias(es). If you unset * by key then the key/value will be unset and any aliases pointing to the * value will be unset. If you unset an alias only that alias will be unset. * * unset($a['key1']); * unset($a['alias1']); * * Iterators iterate across the key array and ignore the alias array. |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.