# Fibonacci Series

### Write a program to find the fibonacci series in php.

In Fibonacci series each number is the sum of the preceding ones.

Eg:- 0 1 1 2 3 5 8 13 121
0+1 = 1, 1+1 = 2, 1+2 = 3, so on

#### Program :

``````<?php
\$num = 0;
\$num1 = 0;
\$num2 = 1;
echo \$num1.' '.\$num2.' ';
while (\$num < 10 )
{
\$num3 = \$num2 + \$num1;
echo \$num3.' ';
\$num1 = \$num2;
\$num2 = \$num3;
\$num = \$num + 1;
}
?>  ``````
1. Define \$num = 0, \$num1 = 0, \$num2 = 1.
2. Print \$num1 and \$num2 as these are the starting numbers
3. In while loop, 10 is the limit
4. Add \$num1 and \$num2 and store to \$num3
5. Print \$num3 as it is the next number
6. Now we have to do the swapping, that means \$num1 assigned with value of \$num2, \$num3 is assigned to \$num2.
7. Then \$num incremented by 1

## 4 thoughts on “Fibonacci Series”

1. continuously i used to read smaller posts which as well clear
their motive, and that is also happening with this post which I am reading at this place.

2. I’m extremely impressed together with your writing skills as smartly as with the layout in your blog.
Is this a paid subject oor did you customize it yourself?
Anyway stay up the nice quality writing, it is uncommon too lookk a great blg