PHP Classes

File: example_fibonacci.php

Recommend this page to a friend!
  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: 14 years ago
Size: 460 bytes
 

Contents

Class file image Download
<?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;
    }
}