PHP Classes

Generic Array: Create arrays that allow members of just one type

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-10-24 (9 years ago) RSS 2.0 feedStarStarStar 57%Total: 629 This week: 2All time: 4,811 This week: 611Up
Version License PHP version Categories
genericarray 1.0.0GNU Lesser Genera...5.1PHP 5, Data types, Code Generation
Description Author

This class can be used to create arrays that allow members of just one type.

It implements a class loader that gives a special treatment to the creation of objects of classes with the names that start with ArrayOf.

The class assumes that it is intended to create an object of a generic class that manages an array of objects of a class named after the ArrayOf prefix.

It generates code for a new generic array handling class based on a generic class template. The generated class uses type hinting to allow only array members of the intended array element class.

This class can be used with the Type Hint class to allow other types of members besides objects and arrays.

Innovation Award
PHP Programming Innovation award nominee
November 2007
Number 9
In PHP arrays may have element values of mixed types. If an application needs to store values of only one specific type, PHP does not stop eventual bugs from storing values of the wrong types in the values.

This class implements an array interface that checks the types of values before adding them to the array, thus making it possible to early detect eventual application bugs.

Manuel Lemos
Picture of Martin Alterisio
Name: Martin Alterisio <contact>
Classes: 5 packages by
Country: Argentina Argentina
Age: 33
All time rank: 7058 in Argentina Argentina
Week rank: 554 Up6 in Argentina Argentina Up
Innovation award
Innovation award
Nominee: 5x

  Files folder image Files  
File Role Description
Files folder imagecache (1 file)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file ArrayOfGenericLoader.php Class Array generic class loader
Accessible without login Plain text file ArrayOfGenericX.php Class Array generic template
Accessible without login Plain text file genericarray.lib.php Aux. Library loader script.

  Files folder image Files  /  cache  
File Role Description
  Accessible without login Plain text file MAKE_THIS_DIR_WRITABLE Doc. Make the cache dir writable or face the wrath of uppercase filenames 2KB
Downloadgenericarray-2007-10-24.tar.gz 1KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Type Hint Class Download .zip .tar.gz Nice addition to create arrays of native types (eg: ArrayOfInt) Recommended
 Version Control Unique User Downloads Download Rankings  
This week:2
All time:4,811
This week:611Up
 User Ratings  
 All time