<commit_before># array_group_by

A function that groups/splits an array by the values of a given key or keys.

# Usage

Example input:

``` php
$records = array (
    array (
        "state" => "IN",
        "city" => "Indianapolis",
        "object" => "School Bus"
    ),
    array (
        "state" => "IN",
        "city" => "Indianapolis",
        "object" => "Manhole"
    ),
    array (
        "state" => "IN",
        "city" => "Plainfield",
        "object" => "Basketball"
    ),
    array (
        "state" => "CA",
        "city" => "San Diego",
        "object" => "Light bulb"
    ),
    array (
        "state" => "CA",
        "city" => "Mountain View",
        "object" => "Space pen"
    )
);

$grouped = array_group_by ( $records, "state", "city" );
```

Example output:

``` text
Array
(
    [IN] => Array
        (
            [Indianapolis] => Array
                (
                    [0] => Array
                        (
                            [state] => IN
                            [city] => Indianapolis
                            [object] => School Bus
                        )

                    [1] => Array
                        (
                            [state] => IN
                            [city] => Indianapolis
                            [object] => Manhole
                        )

                )

            [Plainfield] => Array
                (
                    [0] => Array
                        (
                            [state] => IN
                            [city] => Plainfield
                            [object] => Basketball
                        )

                )

        )

    [CA] => Array
        (
            [San Diego] => Array
                (
                    [0] => Array
                        (
                            [state] => CA
                            [city] => San Diego
                            [object] => Light bulb
                        )

                )

            [Mountain View] => Array
                (
                    [0] => Array
                        (
                            [state] => CA
                            [city] => Mountain View
                            [object] => Space pen
                        )

                )

        )
)
```

# Installation

A Composer package is available for this function. Just add the following to `composer.json`.

``` javascript
{
    "require": {
        "jakezatecky/array_group_by": "~0.7"
    }
}
```

Alternatively, you can just include the `src/array_group_by` file.<commit_msg>Updated README for release including fix.<commit_after># array_group_by

A function that groups/splits an array by the values of a given key or keys.

# Usage

Example input:

``` php
$records = array (
    array (
        "state" => "IN",
        "city" => "Indianapolis",
        "object" => "School Bus"
    ),
    array (
        "state" => "IN",
        "city" => "Indianapolis",
        "object" => "Manhole"
    ),
    array (
        "state" => "IN",
        "city" => "Plainfield",
        "object" => "Basketball"
    ),
    array (
        "state" => "CA",
        "city" => "San Diego",
        "object" => "Light bulb"
    ),
    array (
        "state" => "CA",
        "city" => "Mountain View",
        "object" => "Space pen"
    )
);

$grouped = array_group_by ( $records, "state", "city" );
```

Example output:

``` text
Array
(
    [IN] => Array
        (
            [Indianapolis] => Array
                (
                    [0] => Array
                        (
                            [state] => IN
                            [city] => Indianapolis
                            [object] => School Bus
                        )

                    [1] => Array
                        (
                            [state] => IN
                            [city] => Indianapolis
                            [object] => Manhole
                        )

                )

            [Plainfield] => Array
                (
                    [0] => Array
                        (
                            [state] => IN
                            [city] => Plainfield
                            [object] => Basketball
                        )

                )

        )

    [CA] => Array
        (
            [San Diego] => Array
                (
                    [0] => Array
                        (
                            [state] => CA
                            [city] => San Diego
                            [object] => Light bulb
                        )

                )

            [Mountain View] => Array
                (
                    [0] => Array
                        (
                            [state] => CA
                            [city] => Mountain View
                            [object] => Space pen
                        )

                )

        )
)
```

# Installation

A Composer package is available for this function. Just add the following to `composer.json`.

``` javascript
{
    "require": {
        "jakezatecky/array_group_by": "~0.7.1"
    }
}
```

Alternatively, you can just include the `src/array_group_by` file.
{'fraction_non_alphanumeric': 0.11951126384116074, 'fraction_numerical': 0.0028636884306987398, 'mean_word_length': 0.8241643454038997, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7159201', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1293, 'n_words': 320}