Skip to content

Instantly share code, notes, and snippets.

@ischenkodv
Created October 28, 2015 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischenkodv/34baee481a95da808cb7 to your computer and use it in GitHub Desktop.
Save ischenkodv/34baee481a95da808cb7 to your computer and use it in GitHub Desktop.
Fibonacci function
function fibonacci($n) {
if (is_int($n)) {
return round(pow((sqrt(5)+1)/2, $n) / sqrt(5));
} else {
throw new Exception('Value should be an integer');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment