Skip to content

Instantly share code, notes, and snippets.

@seeruk
Created October 1, 2014 13:46
Show Gist options
  • Save seeruk/60ca7eb7e8aea074db63 to your computer and use it in GitHub Desktop.
Save seeruk/60ca7eb7e8aea074db63 to your computer and use it in GitHub Desktop.
<?php
function fibonacci($n)
{
$fib = [0, 1];
for ($i = 1; ($i + 1) < $n; $i++) {
$fib[] = $fib[$i] + $fib[$i - 1];
}
return $fib;
}
var_dump(fibonacci(100));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment