Created
December 9, 2012 12:11
-
-
Save ichiriac/4244612 to your computer and use it in GitHub Desktop.
fibonnaci short version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fibonnaci short algorithm | |
* @link http://fr.wikipedia.org/wiki/Suite_de_Fibonacci | |
* @author I. CHIRIAC | |
*/ | |
function fibo( $i ) { | |
return ( | |
$i <= 1 ? $i : | |
( | |
fibo($i - 1) + fibo( $i - 2 ) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment