Skip to content

Instantly share code, notes, and snippets.

@mitoop
Last active April 22, 2021 03:00
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 mitoop/d880e1158f49d1d2326b576c24d4120e to your computer and use it in GitHub Desktop.
Save mitoop/d880e1158f49d1d2326b576c24d4120e to your computer and use it in GitHub Desktop.
fibonacci
function fibonacci($item) {
       $a = 0;
       $b = 1;
       for ($i = 0; $i < $item; $i++) {
           yield $a;
           $a = $b - $a;
           $b = $a + $b;
       }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment