Jun 07

Fibonacci Series in PHP

A Fibonacci Series of ┬áNumber (0,1,1,2,3,5,8,13,21,34,55……)

A Fibonacci Series represent in Mathematical term.


F0=0, F1=1

First two number of Fibonacci Series are 0 and 1. After that each number is sum of previous two number. Fibonacci Series was used in ancient india for metric science. It refered as ‘Golden Mean’ in roman.

Some method given below for calculate the Fibonacci Series in php.

Method 1

echo $a;
echo $b;
echo $c;

Method 2

function fibonacci($n,$first = 0,$second = 1)
$fib = [$first,$second];
$fib[] = $fib[$i]+$fib[$i-1];
return $fib;




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>