public function testMap() { $arr = array('John' => 'Vocals', 'Paul' => 'Bass', 'George' => 'Lead', 'Ringo' => 'Drums'); $arr = PHPArray::map($arr, function ($item) { return \strrev($item); }); $this->assertEquals('ssaB', $arr['Paul']); $this->assertEquals('smurD', $arr['Ringo']); }
/** * Returns a new list populated with each value after a given callback * function is applied * @param \Closure $callback * @return \static */ public function map(\Closure $callback) { return new static(PHPArray::map($this->_Arr, $callback)); }