Merge remote-tracking branch 'origin/master'
Conflicts: readme.md
This commit is contained in:
23
readme.md
23
readme.md
@ -1,28 +1,27 @@
|
|||||||
Ary
|
Ary
|
||||||
===
|
===
|
||||||
Ary makes PHP array syntax more flexible in addiction to some really necessary utility methods.
|
Are you tired from casting objects and array to each other? Ary is a light class/function that makes accessing array items more convenient.
|
||||||
|
|
||||||
1. You can access array items using `->` or `[]` syntax.
|
1. You can access array items using `->` or `[]` syntax.
|
||||||
2. You will get `null` if an index does not exists.
|
2. You will get `null` if an index does not exists.
|
||||||
3. You can specify a default value for a missing index.
|
3. You can specify a default value for a missing index.
|
||||||
|
|
||||||
|
|
||||||
~~~~~
|
~~~~~
|
||||||
// instantiation
|
// instantiation
|
||||||
$ary= new Ary();
|
$ary = new Ary();
|
||||||
// or simply
|
// or simply
|
||||||
$ary=ary();
|
$ary = ary();
|
||||||
|
|
||||||
// filling ary
|
// filling ary
|
||||||
|
|
||||||
$ary=ary(2,4,6,8); //or
|
$ary = ary(2, 4, 6, 8); //or
|
||||||
$ary=ary([2,4,6,8]); //or
|
$ary = ary([2, 4, 6, 8]); //or
|
||||||
|
|
||||||
$ary=ary(['x'=>'foo','y'=>'bar]);
|
$ary = ary(['x' => 'foo', 'y' => 'bar']);
|
||||||
$foo= $ary->foo; //or
|
$foo = $ary->foo; //or
|
||||||
$foo= $ary['foo'];
|
$foo = $ary['foo'];
|
||||||
|
|
||||||
$missed=$ary->get('missed','Default value');
|
$missed = $ary->get('missed', 'Default value');
|
||||||
|
|
||||||
count($ary); //return 3
|
count($ary); //returns 3
|
||||||
$ary->all(); // return simple php array;
|
$ary->all(); // returns simple php array;
|
Reference in New Issue
Block a user