PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of R.B. Klaassen   Number Sequence   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Number Sequence
Format an array of numbers as a sequence or ranges
Author: By
Last change: Changed the example array
Date: 16 years ago
Size: 494 bytes
 

Contents

Class file image Download
<?php
/**
 * Example of numberSequence class
 */

require_once('numberSequence.class.php');

$my_array = array(1,3,4,5,8,10,12,13,14,500,501,498,499,12,12,12,0,2);

// you can either do this
echo '<p>array('.implode(',',$my_array).') gives: '.numberSequence::format($my_array).'</p>';

// or instantiate the class if you intent to use it more often in your page
$obj = new numberSequence();
echo
'<p>array('.implode(',',$my_array).') gives: '.$obj->format($my_array).'</p>';

?>