1. Read
  2. Vote
  3. Old
  4. New
  5. Hot
  6. Reply

Finding the Nth Fibonacci number via PHP

Here is an example of Fibonacci numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...

Write a function f(x) so that return the following eg:

f(2) = 1 f(4) = 2 f(6) = 5 f(8) = 13 etc

And here is the code: function f($x = 0) { if ($x < 2) { return $x; } else { return f($x - 2) + f($x - 1); } }
Cat: General | Read: 58889 | 01/11/2018 | Like: 1

SMINT menu bar: fixed when scrolling

This bar will be fixed when scrolling down


#demo.fixed{position:fixed;top:0;z-index:1}

$(document).ready(function (){
var top=$('#demo').offset().top-parseFloat($('#demo').css('marginTop').replace(/auto/,100));
$(window).scroll(
Cat: General | Read: 61417 | 10/12/2013

Screenfly / Test Your Website at Different Screen Resolutions

Cat: General | Read: 14519 | 23/10/2013

Category