Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.14 KB

GenericCollections.md

File metadata and controls

43 lines (34 loc) · 1.14 KB

Generic Collection

This type of Collection can contain items of differing types. You can store integers, objects, callables, etc. all in each instance of \VersatileCollections\GenericCollection.

Use this type of collection if you don't need strict-typing.

Example Usage:

    
    $collection = new \VersatileCollections\GenericCollection(
        1, // integer
        2.5, // float
        function() { return 'boo'; }, // callable
        new StdClass(), // object 
        tmpfile(), // resource
        'Hello World!' // string 
    );

    // OR
    
    $collection = \VersatileCollections\GenericCollection::makeNew(
        [
            1, // integer
            2.5, // float
            function() { return 'boo'; }, // callable
            new StdClass(), // object 
            tmpfile(), // resource
            'Hello World!' // string
        ]
    );

    // OR

    $collection = new \VersatileCollections\GenericCollection();
    $collection[] = 1;
    $collection[] = 2.5;
    $collection[] = function() { return 'boo'; };
    $collection[] = new StdClass();
    $collection[] = tmpfile();
    $collection[] = 'Hello World!';