public function testEach() { $arr = array(3, 2, 1); $sum = 0; PHPArray::each($arr, function ($item) use(&$sum) { $sum += $item; }); $this->assertEquals(6, $sum); }
/** * Performs an action for each item in the list * @param \Closure $action * @return \Cola\ArrayList */ public function each(\Closure $action) { PHPArray::each($this->_Arr, $action); return $this; }