Generates an array, containing the Fibonacci Sequence, up until the x-th term.
function generateFibonacciSequence($x)
{
$sequence = [0, 1];
for ($i = 2; $i < $x; $i++) {
$sequence[$i] = $sequence[$i-1] + $sequence[$i-2];
}
return $sequence;
}
generateFibonacciSequence(10); // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]