From 5a47e368189e27a1f7f196ad456c65986f21b54f Mon Sep 17 00:00:00 2001 From: Dusan Kasan Date: Fri, 3 Jun 2016 09:39:27 +0200 Subject: [PATCH] Sum and average readme updated --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bc9e0f9..942ca63 100644 --- a/README.md +++ b/README.md @@ -278,14 +278,15 @@ Collection::from([1, 3, 3, 2]) toArray(append([1, 3, 3, 2], 1, 'key')); //[1, 3, 3, 2, 'key' => 1] ``` -#### average() : double +#### average() : int|float Returns average of values in this collection. ```php -Collection::from([1, 2, 3, 2])->average(); //2.0 -Collection::from([])->average(); //0.0 +Collection::from([1, 2, 3, 2])->average(); //2 +Collection::from([1, 2, 3, 2, 2])->average(); //2.2 +Collection::from([])->average(); //0 ``` ```php -average([1, 2, 3]); //2.0 +average([1, 2, 3]); //2 ``` #### combine(array|Traversable $collection, bool $strict = false) : Collection @@ -1166,10 +1167,11 @@ Collection::from([1, 3, 3, 2]) toArray(splitWith([1, 3, 3, 2], function ($value) {return $value < 3;})); //[[1], [1 => 3, 2 => 3, 3 => 2]] ``` -#### sum() : double +#### sum() : int|float Returns a sum of all values in this collection. ```php Collection::from([1, 2, 3])->sum(); //6 +Collection::from([1, 2, 3, 1.5])->sum(); //7.5 Collection::from([])->sum(); //0 ``` ```php