Archive for the 'Uncategorized' Category

26
Jul

Fuzzy array search using PHP.

Update on the fuzzy string search with PHP article. I’ve seen a few searches from Google of people try to find out how to do a fuzzy / approximate string search against array values, well today I have the class for doing just that.

The class is simple to use.
It also does multi-level searching, so embed the arrays as far as you want.

<?php
    include "FuzzyArraySearch.php";
    $search = new ArraySearch("test", array("pest");
    $search->Search();
    $search->GetResults();
?>

As a quick example, the following array.

array("rest", "string", "blah", array("hello", array("again", array(array(array("reset"), "rest"))), "pest"))

Output the following when var_dumping the results.

array
  0 => string 'rest at Base->0' (length=15)
  1 => string 'reset at Base->3->1->1->0->0->0' (length=31)
  2 => string 'rest at Base->3->1->1->0->0->1' (length=30)
  3 => string 'pest at Base->3->1->2' (length=21)

Quite simple. Anyhow, that is all I wanted to post, the download link is just below.

Fuzzy Array Search (71)

03
Jul

Hello world!

Well, here is my first post on my new blog / site (Code for thought).

So to get started, my name is Cory. I like to write code, dabble in electronics and mostly anythng that has to do with computers. On this blog in future posts you will find things such as C#/.NET code as well as controls for .NET. You may also find some PHP, C/C++, as well as just other random topics.

So welcome and hopefully you’ll come back later for more.