Skip to content

Commit

Permalink
Added example of numeric keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Alaa Sarhan authored Oct 14, 2016
1 parent 995f977 commit ab77af1
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,27 @@ $uris = Flatten::flatten($api, '/', 'https://api.dummyhost.domain/');
)

*/
```
```

Numeric arrays will be also flattened using the numeric keys.
```php
$nutrition = [
'nutrition',
'fruits' => [ 'oranges', 'apple', 'banana' ],
'veggies' => ['lettuce', 'broccoli'],
];

$nutrition = Flatten::flatten($nutrition, '-');

/* print_r($nutrition):
Array
(
[0] => nutrition
[fruits-0] => oranges
[fruits-1] => apple
[fruits-2] => banana
[veggies-0] => lettuce
[veggies-1] => broccoli
)
*/
```

0 comments on commit ab77af1

Please sign in to comment.