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:
- First initial the 1st and 2nd number as 0 and 1.
- Print 1st and 2nd number.
- From next number, start loop(for loop using here). So 3rd number will be the sum of the previous two numbers.
Output: 0 1 1 2 3
PHP Fundamental Tutorials with Basic Demo by Chentan in 2020 – Part-1
PHP Fundamental Tutorials with Basic Demo by Chentan in 2020 – Part-2
Latest posts by Usha Kiran (see all)
- How to Login with Token in Laravel PHP Framework? - October 30, 2021
- How to merge two or multiple tables to each other in the Laravel PHP Framework? (Part-4) - October 29, 2021
- How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? Part-2 - October 29, 2021