germancin
5/20/2018 - 8:43 PM

fibonacci using reduce

fibonacci using reduce

<?php

$array = [];
$n = 80000;

for($i=1; $i <= $n; $i++){
	$array[] = $i;
}

print_r(array_reduce($array, function($res, $number){
	
	$rest = $number + $res;
	echo $rest . " - ";
	return $rest;
	
}));