Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel reduce

$collection = collect([1, 2, 3]);

$total = $collection->reduce(function ($carry, $item) {
    return $carry + $item;
});

// 6

$total = $collection->reduce(function ($carry, $item) {
    return $carry + $item;
}, 4);

// 10   | where 4 is a initial value
Comment

PREVIOUS NEXT
Code Example
Php :: php constant array 
Php :: larvel make http request 
Php :: why pusher not working in laravel 
Php :: store image to s3 laravel 
Php :: php info 
Php :: php test page 
Php :: php get day number 
Php :: php string parse with separator explode 
Php :: get month first date and last date in php 
Php :: Notice: Trying to access array offset on value of type int in /var/www/pdam/modules/phpexcel/PHPExcel/Cell/DefaultValueBinder.php on line 82 
Php :: php get current dir mac 
Php :: php scandir 
Php :: how get the Photo size upload in laravel 
Php :: delete in crud php 
Php :: get text field value in php 
Php :: laravel csrf token mismatch postman 
Php :: PHP Function to create GUID 
Php :: File Reading Modes PHP 
Php :: php back to original site 
Php :: search function using php for database entries 
Php :: php cut string 
Php :: define constant in php 
Php :: laravel date format 
Php :: how to collapse array in laravel 
Php :: base64 enocode php 
Php :: laravel validation unique two columns 
Php :: how to create controller inside folder in laravel 
Php :: installing php on ubuntu 
Php :: how to use stored procedure in laravel 
Php :: php if negative make positive 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =