You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A. B. M. Mahmudul Hasan edited this page Apr 11, 2022
·
2 revisions
Why?
It may be not common for everyone but for some of us, where we faced that we need an array to be used as object or vice versa. Obviously for different scenario. Also there is some use cases where a method only available to object or another method available to only array.
Uses
Simply define a variable like
$myVariable = newArrject($myVariable);
And you are good to go!
What is available for me?
All the methods implemented by ArrayAccess, Iterator, Countable, JsonSerializable and some additional methods to satisfy & provide several other functionality (overload, loop ability)!
Additionally, you will also get,
getIterator(): get ArrayIterator instance,
merge(Arrject|Belt|array $data): Merge more data into existing,
filter(callable $callback): remove data from existing collection with given callback,
map(callable $callback): map data by callback
getArrayableItems(mixed $items): get array from other convertibles (JsonSerializable, Traversable, ...)