array-object-array/README.md

36 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2016-07-21 14:56:56 -07:00
# ArrayObjectArray [![Build Status](https://travis-ci.org/sikofitt/array-object-array.svg?branch=master)](https://travis-ci.org/sikofitt/array-object-array) [![Coverage Status](https://coveralls.io/repos/github/sikofitt/array-object-array/badge.svg?branch=master)](https://coveralls.io/github/sikofitt/array-object-array?branch=master)
2016-07-20 14:07:40 -07:00
This is an incredibly simple class extension of `\ArrayObject` to provide
array functions use the magic `__call` method. I no longer like writing this
with every project I want to use it in.
Original was from this great bloke. https://secure.php.net/manual/en/class.arrayobject.php#107079
## Install
`composer require sikofitt/array-object-array`
## Usage
```php
$arrObj = new Sikofitt\Utility\ArrayObjectArray($myarray);
```
then use it with any array_* function.
```php
$arrObj->array_keys();
$arrObj->array_values();
2016-07-20 14:19:09 -07:00
$arrObj->array_map(
function($value) {
print sprintf("%s\n", $value);
}
);
2016-07-20 14:07:40 -07:00
```
```php
$arrObj->exchangeArray($myNewArray);
```
## License
MIT
## Todo
Finish writing the rest of the tests for array_* functions
2016-07-20 14:19:09 -07:00