Mecha CMS

$anemon->__construct()

Create magic array.

2.0.0

$anemon->__construct(iterable $value, string $join = ', ');

Example:

$anemon = new Anemon(['foo', 'bar', 'baz']);

echo $anemon;
echo $anemon(' | ');
echo $anemon[0];
echo $anemon[999];
echo $anemon->get(1);
echo $anemon->last();

Result:

'foo, bar, baz'
'foo | bar | baz'
'foo'
null
'bar'
'baz'

An instance of Anemon class can be used to make the array becomes possible to be accessed as string, array, or function. Items with null and false value and items with key prefixed by a _ will be ignored by default.