fibonacci number code in php
<?php
function fibonacci($n)
{
$a = 1;
$b = 1;
for ($i = 0; $i < $n; $i=$i+1)
{
echo “ ”.$a;
$sum = $a+$b;
$a = $b;
$b = $sum;
}
}
echo fibonacci(20);
?>
Output comes like:
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
Share on Facebook
Fatal error: Uncaught mysqli_sql_exception: MySQL server has gone away in /Applications/MAMP/htdocs/bharatbaba.com/classCommon.php:67
Stack trace:
#0 /Applications/MAMP/htdocs/bharatbaba.com/classCommon.php(67): mysqli_query(Object(mysqli), 'INSERT INTO ips...')
#1 /Applications/MAMP/htdocs/bharatbaba.com/analytics.jay.php(52): common::sql_query('INSERT INTO ips...')
#2 /Applications/MAMP/htdocs/bharatbaba.com/footer.php(76): require_once('/Applications/M...')
#3 /Applications/MAMP/htdocs/bharatbaba.com/blog.php(120): require_once('/Applications/M...')
#4 {main}
thrown in
/Applications/MAMP/htdocs/bharatbaba.com/classCommon.php on line
67