- addiing toObj method

- adding merge metho
- enhancing getArrayableItems
This commit is contained in:
Reza
2015-10-06 12:29:33 +03:30
parent 80c2b98117
commit 1d1e9b61ef
2 changed files with 31 additions and 5 deletions

View File

@ -2,9 +2,9 @@ Ary
===
Are you tired from casting objects and arrays to each other? Don't do that anymore! Ary is a light class/function that makes accessing array items more convenient.
1. You can access array items using `->` or `[]` syntax.
2. You will get `null` if an index does not exists.
3. You can specify a default value for a missing index.
1. You can access array items using `->` or `['']` syntax.
2. You will get `null` if an index does not exists (instead of a nasty notification!)
3. You can specify a default value for missing indexes.
* The class (`Ary()`) requires PHP 5.4 or newer.
* The helper function (`ary()`) requires PHP 5.6 or newer.
@ -18,7 +18,7 @@ $ary = ary();
//setting and getting array items.
$ary = ary(2, 4, 6, 8); //or
$ary = ary([2, 4, 6, 8]); //or
$ary = ary([2, 4, 6, 8]);
$ary = ary(['x' => 'foo', 'y' => 'bar']);
$foo = $ary->x; //or