Ver original$data = array('12/10/1989','11/05/1989','02/12/2011'); function getYearsFromArray(Array $data) { return array_map(function($data){ return (new DateTime($data))->format('Y'); }, $data);} var_dump(getYearsFromArray($data));