PHP Classes

PHP Fast Pattern Matching: Match text patterns using ternary tries

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 480 All time: 5,948 This week: 673Up
Version License PHP version Categories
fastpm 0.1Free for non-comm...5.0Algorithms, PHP 5, Searching, Text pr...


This package can match text patterns using ternary tries.

The main class can add text strings as symbol keys and it builds a ternary trie.

The class can also take a key string to match by searching the ternary trie. It returns an array with all the matches.

Innovation Award
PHP Programming Innovation award nominee
February 2015
Number 4

Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
Text pattern matching is a process of determining if a given text string contains sequences of characters that match a given pattern.

In PHP text pattern matching can be done using regular expressions and the preg extension.

This class provides a pure PHP approach for implementing text pattern matching by the use ternary tries.

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 34122 in France France
Week rank: 20 Up2 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x


* (c) 2015 Chi Hoang (
* 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 ();
//echo $tree->match ("banananassata");

//$tree = new Fastpm\Fastpm ();
//echo $tree->match ("ushers");

//$tree = new Fastpm\Fastpm ();
//echo $tree->match("botttea");

$tree = new Fastpm\Fastpm ();


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example script
Plain text file fastpm.php Class Main class
Accessible without login Plain text file unittest.php Test Unit Test

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,948
This week:673Up
 User Ratings  
 All time