I conceived it myself, and the fact that the program solves the problem is an offset. First look at the series:: 1, 1, 2, 3, 5, 8, 13, 21, 34 the next number of series is the sum of the first 2 numbers, and so on.
Program processing, is actually a for statement, the traditional for statement is for ($i =1; $i; $count, $i + +), where the offset is $i= $i +1. If this sequence is processed, the offset is not 1, which is the first 1 digits. So when you have a for, a variable records the previous number, the other one records the current number, the offset is the number, and then it is re-assigned in the loop, and the previous number is recorded as a course loop value, which is the offset of the next loop. The code is actually simple:
Copy CodeThe code is as follows:
$count = 9999999999967543;
$array = Array (' 0′=>1);
For ($a =1, $i =2; $i < $count; $i = $i + $a) {
$array [] = $a;
$array [] = $i;
$a = $a + $i;
}
Print_r ($array);
echo $count. ' There '. Count ($array). ' A Fibonacci number ';
Suggest which boring people take this to phpchina to the cabbage profession top sticker
http://www.bkjia.com/PHPjc/324859.html www.bkjia.com true http://www.bkjia.com/PHPjc/324859.html techarticle I conceived it myself, and the fact that the program solves the problem is an offset. First look at the series:: 1, 1, 2, 3, 5, 8, 13, 21, 34 the next number of series is the first 2 ...