PHP Program to Find Fibonacci Series



In this post I am going to describe the PHP Program which tell us about how to find Fibonacci Series. Fibonacci Series is a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
<?php
if(isset($_POST['submit'])){
	$number= $_POST['number'];
	$a=0;
	$b=1;
	for($i=1;$i<=$number;$i++){
		echo $a.", ";
		$c=$a;
		$a=$a+$b;
		$b=$c;
	}
}
?>
<html>
	<head>
		<title>Fibonacci Series</title>
	</head>
	<body>
		<form action="" method='POST'>
		<label for="number">Please Enter Length of series</label>
		<input type="text" name="number" value="">
		<br><br>
		
		<input type="submit" value="Done" name="submit">
		</form>
	</body>
</html>

Program Output:

Stay tuned for the PHP Magento, WordPress and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development / PHP we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.