|
| 1 | + |
| 2 | + |
1 | 3 | # AssociativeArray
|
2 | 4 |
|
| 5 | +[](https://travis-ci.org/nick-lai/associative-array) |
3 | 6 | [](https://travis-ci.org/nick-lai/associative-array)
|
4 | 7 | [](https://codecov.io/gh/nick-lai/associative-array)
|
5 | 8 | [](https://codeclimate.com/github/nick-lai/associative-array/maintainability)
|
6 | 9 | [](https://scrutinizer-ci.com/g/nick-lai/associative-array/?branch=master)
|
7 |
| - |
8 |
| -[](https://travis-ci.org/nick-lai/associative-array) |
9 | 10 | [](https://packagist.org/packages/nick-lai/associative-array)
|
10 | 11 | [](https://packagist.org/packages/nick-lai/associative-array)
|
11 |
| -[](https://packagist.org/packages/nick-lai/associative-array) |
| 12 | + |
| 13 | +**A lightweight associative array library for PHP.** |
12 | 14 |
|
13 | 15 | # Table of Contents
|
14 | 16 |
|
|
22 | 24 | - [rightJoin()](#rightjoin)
|
23 | 25 | - [orderBy()](#orderby)
|
24 | 26 | - [groupBy()](#groupby)
|
| 27 | + - [make()](#make) |
25 | 28 | - [first()](#first)
|
26 | 29 | - [last()](#last)
|
27 | 30 | - [count()](#count)
|
@@ -501,6 +504,30 @@ array (
|
501 | 504 | )
|
502 | 505 | ```
|
503 | 506 |
|
| 507 | +### make() |
| 508 | + |
| 509 | +Create a new associative array instance. |
| 510 | + |
| 511 | +```php |
| 512 | +$data = [ |
| 513 | + ['id' => 1001, 'category' => 'C', 'price' => 10], |
| 514 | + ['id' => 1002, 'category' => 'A', 'price' => 25], |
| 515 | + ['id' => 1003, 'category' => 'B', 'price' => 10], |
| 516 | +]; |
| 517 | + |
| 518 | +var_export(AssociativeArray::make($data)->first()); |
| 519 | +``` |
| 520 | + |
| 521 | +Result: |
| 522 | + |
| 523 | +``` |
| 524 | +array ( |
| 525 | + 'id' => 1001, |
| 526 | + 'category' => 'C', |
| 527 | + 'price' => 10, |
| 528 | +) |
| 529 | +``` |
| 530 | + |
504 | 531 | ### first()
|
505 | 532 |
|
506 | 533 | Return the first row
|
|
0 commit comments