PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Shannon Wynter   Permutator   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Permutator
Generate permutations of elements of an array
Author: By
Last change:
Date: 14 years ago
Size: 401 bytes
 

Contents

Class file image Download
<?php
include_once('Permutator.class.php');

// Create a list of things to run against
$list = array('dog', 'cat', 'horse', 'brid', 'tree');

// And a callback function
function echoit($list) {
        echo
join(', ', $list) . "\n";
}

// Create a permutator
$obj = new Permutator($list, 'echoit');

echo
"There are ", $obj->factors(), " possible permutations\n\n";

$obj->process();