PHP Classes

File: example_fibonacci.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Artur Barseghyan  >  Fibonacci  >  example_fibonacci.php  >  Download  
File: example_fibonacci.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Fibonacci
Generate Fibonacci sequence numbers
Author: By
Last change: Making accessible without login.
Date: 4 years ago
Size: 460 bytes


Class file image Download
 * 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