{"id":46419940,"url":"https://github.com/nick-lai/associative-array","last_synced_at":"2026-03-05T15:32:52.684Z","repository":{"id":57026600,"uuid":"194313035","full_name":"nick-lai/associative-array","owner":"nick-lai","description":"⚡ A lightweight associative array library for PHP.","archived":false,"fork":false,"pushed_at":"2025-11-24T03:36:01.000Z","size":27,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-24T05:30:51.391Z","etag":null,"topics":["associative-array","composer-package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nick-lai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-28T17:48:37.000Z","updated_at":"2025-11-24T03:33:56.000Z","dependencies_parsed_at":"2022-08-23T16:20:32.437Z","dependency_job_id":null,"html_url":"https://github.com/nick-lai/associative-array","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/nick-lai/associative-array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fassociative-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fassociative-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fassociative-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fassociative-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nick-lai","download_url":"https://codeload.github.com/nick-lai/associative-array/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nick-lai%2Fassociative-array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30133256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T14:41:47.141Z","status":"ssl_error","status_checked_at":"2026-03-05T14:41:21.567Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["associative-array","composer-package","php"],"created_at":"2026-03-05T15:32:52.584Z","updated_at":"2026-03-05T15:32:52.673Z","avatar_url":"https://github.com/nick-lai.png","language":"PHP","readme":"AssociativeArray\n===\n\n[![Tests](https://github.com/nick-lai/associative-array/actions/workflows/tests.yml/badge.svg)](https://github.com/nick-lai/associative-array/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/nick-lai/associative-array/graph/badge.svg?token=YsIS8SEGox)](https://codecov.io/gh/nick-lai/associative-array)\n[![Maintainability](https://api.codeclimate.com/v1/badges/619cef82d3eba2ea735c/maintainability)](https://codeclimate.com/github/nick-lai/associative-array/maintainability)\n[![Packagist](https://img.shields.io/packagist/v/nick-lai/associative-array.svg)](https://packagist.org/packages/nick-lai/associative-array)\n[![Total Downloads](https://img.shields.io/packagist/dt/nick-lai/associative-array.svg?color=brightgreen)](https://packagist.org/packages/nick-lai/associative-array)\n\n**A lightweight associative array library for PHP.**\n\n## Table of Contents\n\n- [AssociativeArray](#associativearray)\n  - [Table of Contents](#table-of-contents)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n  - [Basic Usage](#basic-usage)\n    - [select()](#select)\n    - [where()](#where)\n    - [innerJoin()](#innerjoin)\n    - [leftJoin()](#leftjoin)\n    - [rightJoin()](#rightjoin)\n    - [orderBy()](#orderby)\n    - [groupBy()](#groupby)\n    - [make()](#make)\n    - [first()](#first)\n    - [last()](#last)\n    - [count()](#count)\n    - [sum()](#sum)\n    - [avg()](#avg)\n    - [toArray()](#toarray)\n    - [Array Access](#array-access)\n    - [Traversable](#traversable)\n  - [License](#license)\n\n## Requirements\n\nAssociativeArray requires PHP \u003e= 7.0.0\n\n## Installation\n\n```sh\ncomposer require nick-lai/associative-array\n```\n\n## Basic Usage\n\n```php\nuse NickLai\\AssociativeArray;\n\n$data = [\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 20],\n    ['id' =\u003e 1002, 'category' =\u003e 'B', 'price' =\u003e 15],\n    ['id' =\u003e 1003, 'category' =\u003e 'A', 'price' =\u003e 15],\n    ['id' =\u003e 1004, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1005, 'category' =\u003e 'B', 'price' =\u003e 10],\n];\n\n$associativeArray = new AssociativeArray($data);\n\nvar_export([\n    'first' =\u003e $associativeArray-\u003efirst(),\n    'last' =\u003e $associativeArray-\u003elast(),\n    'count' =\u003e $associativeArray-\u003ecount(),\n    'sum(price)' =\u003e $associativeArray-\u003esum('price'),\n    'avg(price)' =\u003e $associativeArray-\u003eavg('price'),\n]);\n```\n\nResult:\n\n```\narray (\n  'first' =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 20,\n  ),\n  'last' =\u003e\n  array (\n    'id' =\u003e 1005,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n  ),\n  'count' =\u003e 5,\n  'sum(price)' =\u003e 85,\n  'avg(price)' =\u003e 17,\n)\n```\n\n### select()\n\nGet rows of selected columns.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 30],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003eselect(['id', 'price'])-\u003etoArray());\nvar_export($associativeArray-\u003eselect(['category', 'price'])-\u003etoArray());\n```\n\nResult:\n\n```\narray (\n  0 =\u003e\n  array (\n    'id' =\u003e 1001,\n    'price' =\u003e 30,\n  ),\n  1 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'price' =\u003e 25,\n  ),\n  2 =\u003e\n  array (\n    'id' =\u003e 1003,\n    'price' =\u003e 10,\n  ),\n)\n\narray (\n  0 =\u003e\n  array (\n    'category' =\u003e 'C',\n    'price' =\u003e 30,\n  ),\n  1 =\u003e\n  array (\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n  ),\n  2 =\u003e\n  array (\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n  ),\n)\n```\n\n### where()\n\nFilter the rows using the given callback.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 30],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\n$result = $associativeArray-\u003ewhere(function ($row) {\n    return $row['price'] \u003e 10;\n})-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  0 =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 30,\n  ),\n  1 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n  ),\n)\n```\n\n### innerJoin()\n\nInner join rows\n\n```php\n$associativeArray = new AssociativeArray([\n    1001 =\u003e ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 30],\n    1002 =\u003e ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    1003 =\u003e ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n    1004 =\u003e ['id' =\u003e 1004, 'category' =\u003e 'X', 'price' =\u003e 60],\n]);\n\n$categories = [\n    'A' =\u003e ['category' =\u003e 'A', 'desc' =\u003e 'A desc'],\n    'B' =\u003e ['category' =\u003e 'B', 'desc' =\u003e 'B desc'],\n    'C' =\u003e ['category' =\u003e 'C', 'desc' =\u003e 'C desc'],\n    'D' =\u003e ['category' =\u003e 'D', 'desc' =\u003e 'D desc'],\n];\n\n$result = $associativeArray-\u003einnerJoin($categories, function ($leftRow, $rightRow) {\n    return $leftRow['category'] === $rightRow['category'];\n})-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  1001 =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 30,\n    'desc' =\u003e 'C desc',\n  ),\n  1002 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n    'desc' =\u003e 'A desc',\n  ),\n  1003 =\u003e\n  array (\n    'id' =\u003e 1003,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n    'desc' =\u003e 'B desc',\n  ),\n)\n```\n\n### leftJoin()\n\nLeft join rows\n\n```php\n$associativeArray = new AssociativeArray([\n    1001 =\u003e ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 30],\n    1002 =\u003e ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    1003 =\u003e ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n    1004 =\u003e ['id' =\u003e 1004, 'category' =\u003e 'X', 'price' =\u003e 60],\n]);\n\n$categories = [\n    'A' =\u003e ['category' =\u003e 'A', 'desc' =\u003e 'A desc'],\n    'B' =\u003e ['category' =\u003e 'B', 'desc' =\u003e 'B desc'],\n    'C' =\u003e ['category' =\u003e 'C', 'desc' =\u003e 'C desc'],\n    'D' =\u003e ['category' =\u003e 'D', 'desc' =\u003e 'D desc'],\n];\n\n$result = $associativeArray-\u003eleftJoin($categories, function ($leftRow, $rightRow) {\n    return $leftRow['category'] === $rightRow['category'];\n})-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  1001 =\u003e\n  array (\n    'id' =\u003e 1001,      \n    'category' =\u003e 'C', \n    'price' =\u003e 30,     \n    'desc' =\u003e 'C desc',\n  ),\n  1002 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n    'desc' =\u003e 'A desc',\n  ),\n  1003 =\u003e\n  array (\n    'id' =\u003e 1003,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n    'desc' =\u003e 'B desc',\n  ),\n  1004 =\u003e\n  array (\n    'id' =\u003e 1004,\n    'category' =\u003e 'X',\n    'price' =\u003e 60,\n    'desc' =\u003e NULL,\n  ),\n)\n```\n\n### rightJoin()\n\nRight join rows\n\n```php\n$associativeArray = new AssociativeArray([\n    1001 =\u003e ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 30],\n    1002 =\u003e ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    1003 =\u003e ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n    1004 =\u003e ['id' =\u003e 1004, 'category' =\u003e 'X', 'price' =\u003e 60],\n]);\n\n$categories = [\n    'A' =\u003e ['category' =\u003e 'A', 'desc' =\u003e 'A desc'],\n    'B' =\u003e ['category' =\u003e 'B', 'desc' =\u003e 'B desc'],\n    'C' =\u003e ['category' =\u003e 'C', 'desc' =\u003e 'C desc'],\n    'D' =\u003e ['category' =\u003e 'D', 'desc' =\u003e 'D desc'],\n];\n\n$result = $associativeArray-\u003erightJoin($categories, function ($leftRow, $rightRow) {\n    return $leftRow['category'] === $rightRow['category'];\n})-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  'A' =\u003e\n  array (\n    'category' =\u003e 'A',\n    'desc' =\u003e 'A desc',\n    'id' =\u003e 1002,\n    'price' =\u003e 25,\n  ),\n  'B' =\u003e\n  array (\n    'category' =\u003e 'B',\n    'desc' =\u003e 'B desc',\n    'id' =\u003e 1003,\n    'price' =\u003e 10,\n  ),\n  'C' =\u003e\n  array (\n    'category' =\u003e 'C',\n    'desc' =\u003e 'C desc',\n    'id' =\u003e 1001,\n    'price' =\u003e 30,\n  ),\n  'D' =\u003e\n  array (\n    'category' =\u003e 'D',\n    'desc' =\u003e 'D desc',\n    'id' =\u003e NULL,\n    'price' =\u003e NULL,\n  ),\n)\n```\n\n### orderBy()\n\nOrder by keys\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\n$result = $associativeArray-\u003eorderBy(['price', 'category'], ['desc', 'asc'])-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  0 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n  ),\n  1 =\u003e\n  array (\n    'id' =\u003e 1003,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n  ),\n  2 =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 10,\n  ),\n)\n```\n\nKeep index\n\n```php\n$associativeArray = new AssociativeArray([\n    'X' =\u003e ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    'Y' =\u003e ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    'Z' =\u003e ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\n$result = $associativeArray-\u003eorderBy('category', 'asc', true)-\u003etoArray();\n\nvar_export($result);\n```\n\nResult:\n\n```php\narray (\n  'Y' =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n  ),\n  'Z' =\u003e\n  array (\n    'id' =\u003e 1003,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n  ),\n  'X' =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 10,\n  ),\n)\n```\n\n### groupBy()\n\nGroups an associative array by keys.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'B', 'price' =\u003e 30],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 30],\n    ['id' =\u003e 1004, 'category' =\u003e 'A', 'price' =\u003e 30],\n]);\n\n$result = $associativeArray-\u003egroupBy(['category', 'price']);\n\nvar_export($result);\n```\n\nResult:\n\n```\narray (\n  'B' =\u003e \n  array (\n    30 =\u003e \n    array (\n      0 =\u003e \n      array (\n        'id' =\u003e 1001,\n        'category' =\u003e 'B',\n        'price' =\u003e 30,\n      ),\n      1 =\u003e \n      array (\n        'id' =\u003e 1003,\n        'category' =\u003e 'B',\n        'price' =\u003e 30,\n      ),\n    ),\n  ),\n  'A' =\u003e \n  array (\n    25 =\u003e \n    array (\n      0 =\u003e \n      array (\n        'id' =\u003e 1002,\n        'category' =\u003e 'A',\n        'price' =\u003e 25,\n      ),\n    ),\n    30 =\u003e \n    array (\n      0 =\u003e \n      array (\n        'id' =\u003e 1004,\n        'category' =\u003e 'A',\n        'price' =\u003e 30,\n      ),\n    ),\n  ),\n)\n```\n\n### make()\n\nCreate a new associative array instance.\n\n```php\n$data = [\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n];\n\nvar_export(AssociativeArray::make($data)-\u003efirst());\n```\n\nResult:\n\n```\narray (\n  'id' =\u003e 1001,\n  'category' =\u003e 'C',\n  'price' =\u003e 10,\n)\n```\n\n### first()\n\nReturn the first row\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003efirst());\n```\n\nResult:\n\n```\narray (\n  'id' =\u003e 1001,\n  'category' =\u003e 'C',\n  'price' =\u003e 10,\n)\n```\n\n### last()\n\nReturn the last row\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003elast());\n```\n\nResult:\n\n```\narray (\n  'id' =\u003e 1003,\n  'category' =\u003e 'B',\n  'price' =\u003e 10,\n)\n```\n\n### count()\n\nCount the number of rows in the associative array.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003ecount());\n```\n\nResult:\n\n```\n3\n```\n\n### sum()\n\nGet the sum of a given key.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003esum('price'));\n```\n\nResult:\n\n```\n45\n```\n\n### avg()\n\nGet the average value of a given key.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003eavg('price'));\n```\n\nResult:\n\n```\n15\n```\n\n### toArray()\n\nGet the instance as an array.\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray-\u003etoArray());\n```\n\nResult:\n\n```\narray (\n  0 =\u003e\n  array (\n    'id' =\u003e 1001,\n    'category' =\u003e 'C',\n    'price' =\u003e 10,\n  ),\n  1 =\u003e\n  array (\n    'id' =\u003e 1002,\n    'category' =\u003e 'A',\n    'price' =\u003e 25,\n  ),\n  2 =\u003e\n  array (\n    'id' =\u003e 1003,\n    'category' =\u003e 'B',\n    'price' =\u003e 10,\n  ),\n)\n```\n\n### Array Access\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nvar_export($associativeArray[0]);\n```\n\nResult:\n\n```\narray (\n  'id' =\u003e 1001,\n  'category' =\u003e 'C',\n  'price' =\u003e 10,\n)\n```\n\n### Traversable\n\n```php\n$associativeArray = new AssociativeArray([\n    ['id' =\u003e 1001, 'category' =\u003e 'C', 'price' =\u003e 10],\n    ['id' =\u003e 1002, 'category' =\u003e 'A', 'price' =\u003e 25],\n    ['id' =\u003e 1003, 'category' =\u003e 'B', 'price' =\u003e 10],\n]);\n\nforeach ($associativeArray as $row) {\n    echo $row['category'] . PHP_EOL;\n}\n```\n\nResult:\n\n```\nC\nA\nB\n```\n\n## License\n\nAssociativeArray is released under the MIT Licence. See the bundled LICENSE file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnick-lai%2Fassociative-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnick-lai%2Fassociative-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnick-lai%2Fassociative-array/lists"}