Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.32 KB

ScalarsCollections.md

File metadata and controls

45 lines (35 loc) · 1.32 KB

Scalars Collection

\VersatileCollections\ScalarsCollection is a Collection class that only accepts items that are scalars (i.e. booleans, floats, integers or strings ). It accepts any mix of scalars, e.g. ints, booleans, floats and strings can all be present in an instance of this type of collection.

Example Usage:

    
    $collection = new \VersatileCollections\ScalarsCollection(
        1, // integer
        2.5, // float
        true, // boolean
        false, // boolean
        'Hello World!' // string 
    );

    // OR
    
    $collection = \VersatileCollections\ScalarsCollection::makeNew([
        1, // integer
        2.5, // float
        true, // boolean
        false, // boolean
        'Hello World!' // string 
    ]);

    // OR

    $collection = new \VersatileCollections\ScalarsCollection();
    $collection[] = 1;
    $collection[] = 2.5;
    $collection[] = true;
    $collection[] = false;
    $collection[] = 'Hello World!';

Other methods applicable to this Collection class and its descendants: