May 2017
Intermediate to advanced
340 pages
8h 16m
English
In mathematics, Fibonacci numbers are special integer sequences where a number is composed from summation of the past two numbers, as shown in the following the expression:

If we implement this using PHP 7, it will look like this:
function fibonacci(int $n): int { if ($n == 0) { return 1; } else if ($n == 1) { return 1; } else { return fibonacci($n - 1) + fibonacci($n - 2); } }
If we consider the preceding implementation, we can see it is a bit different from the previous examples. Now, we are calling two functions from one function call. We will discuss different types of recursions shortly. ...
Read now
Unlock full access