How to print Fibonacci series in PHP embedded in HTML ? -1

How to print Fibonacci series in PHP?

What is Fibonacci series?

A series of numbers in which each number is the sum of the two preceding numbers. The simplest is the series 0,1, 1, 2, 3, 5, 8, & so on. Here, 0+1 = 1 1+1=2 3+2=5 ….

Logic:

  1. First initial the 1st and 2nd number as 0 and 1.
  2. Print 1st and 2nd number.
  3. From next number, start loop(for loop using here). So 3rd number will be the sum of the previous two numbers.
Entering number 5

Output: 0 1 1 2 3