Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arturs Sosins  >  Word Solver  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Simple usage example
Class: Word Solver
Generate words or anagrams from specified rules
Author: By
Last change:
Date: 2011-11-25 07:06
Size: 1,408 bytes
 

Contents

Class file image Download
<?php
/************************************************************* 
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com 
 * Feel free to distribute and modify code, but keep reference to its creator 
 * 
 * Word Solver class can generate words or anagrams using provided rules, for example,
 * possible letters, placement of specific letter, which letters should be used together,
 * or using any character from specified alphabet.
 * This class can be used to generate solutions to scrabble, crosswords, anagrams 
 * and other word games.
 * 
 * For more information, examples and online documentation visit:  
 * http://webcodingeasy.com/PHP-classes/Generate-words-from-specified-rules
**************************************************************/

//it can take some time
set_time_limit(0); 
$time microtime();
$time explode(' '$time);
$start $time[1] + $time[0];

//declaring class instance
include("./word_solver.php");
$ws = new word_solver();

//use all provided letters
$ws->use_all();

//setting rules for words
$ws->set_rules("a(cl)s[s]*e");

//getting results
$arr $ws->get_words();
echo 
"<pre>";
print_r($arr);
echo 
"</pre>";

$time microtime();
$time explode(' '$time);
$end $time[1] + $time[0];
$total_time round(($end $start), 4);
echo 
'<p>PHP execution: '.$total_time.' seconds.</p>';
?>