PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Chi H.   PHP Fast Pattern Matching   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: PHP Fast Pattern Matching
Match text patterns using ternary tries
Author: By
Last change:
Date: 9 years ago
Size: 1,416 bytes
 

Contents

Class file image Download
<?php
/***************************************************************
*
* (c) 2015 Chi Hoang (info@chihoang.de)
* All rights reserved
*
***************************************************************/

require_once ( "fastpm.php" );

//////////////////////////////
//$tree = new Fastpm\Fastpm ();
//$tree->add ("a");
//$tree->add ("ab");
//$tree->add ("bab");
//$tree->add ("bc");
//$tree->add ("bca");
//$tree->add ("c");
//$tree->add ("caa");
//echo $tree->match ("abccab");

//////////////////////////////
//$tree = new Fastpm\Fastpm ();
//$tree->add ("bc");
//$tree->add ("abc");
//echo $tree->match("tabc");

//////////////////////////////
//$tree = new Fastpm\Fastpm ();
//$tree->add("ananas");
//$tree->add("antani");
//$tree->add("assassin");
//echo $tree->match ("banananassata");

//////////////////////////////
//$tree = new Fastpm\Fastpm ();
//$tree->add("he");
//$tree->add("she");
//$tree->add("his");
//$tree->add("hers");
//echo $tree->match ("ushers");

//////////////////////////////
//$tree = new Fastpm\Fastpm ();
//$tree->add("bot");
//$tree->add("otis");
//$tree->add("ott");
//$tree->add("otto");
//$tree->add("tea");
//echo $tree->match("botttea");

$tree = new Fastpm\Fastpm ();
$tree->add("fast");
$tree->add("sofa");
$tree->add("so");
$tree->add("take");
echo
$tree->match("takesofasofastfassofatakesossosofastakeso");

?>