Write a program to print fabonacci series in php.

This is a very general interview question of any interview in programming 

$first = 0;
$second = 1;

for($i=0;$i<=10;$i++){
   $third = $first+$second;
   echo $third.'&nbsp;';
   $first = $second;
   $second = $third;
}

Output :

1 2 3 5 8 13 21 34 55 89 144
You like this post don't forget to leave a comment.

Chears :)
Happy coding

Post a Comment

Previous Post Next Post