Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sequência de Fibonacci
<?php
$fib = array();
for($i = 0; $i < 10; $i++){
if($i < 2){
$fib[$i] = $i;
} else {
$fib[$i] = $fib[$i - 1] + $fib[$i-2];
}
}
foreach($fib as $key => $f){
$coma = '';
if($key > 0){
$coma = ', ';
}
echo $coma . $f;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.