$a = new _array('foo', 'bar'); $a[] = 'baz'; foreach($a as $t) echo $t; #
The 'new' in the above can be omitted, making it look even more "php'ish".
_array also provides a meaningful toString method:
Most _array methods return objects of class _array, thus enabling method chaining:
echo $files->select('is_readable')->map('ucfirst')->natsort()->join("<br>"); #
It's worth noting that every method call creates a new object:
$a = new _array('c', 'a', 'b'); $b = $a->sort(); echo $a; # "c, a, b" echo $b; # "a, b, c"
Exception are few modificator methods like _array::pop().
Along with main class the package contains a set of utility functions that provide syntactic sugar for creating _array objects from different sources:
1.5.5