Location: PHPKode > scripts > Fibonacci > example_fibonacci.php
<?php
/* 
 * Usage example.
 *
 * @author Artur Barseghyan
 */

require_once 'Fibonacci.class.php'; // Loading the file

$f = new Fibonacci(); // Initiating the class

$i = 0; // Setting the counter (not to run out of memory)
foreach ($f as $item) { // Looping through the items
    echo $item . PHP_EOL; // Simple output
    ++$i; // Increasing the counter
    if ($i > 1000) { // Checking if not going over the limit
        return;
    }
}
Return current item: Fibonacci