Actually I found out that php.net offers the source code for that part :)
here it is: http://ca.php.net/source.php?url=/quickref.php

...and I was able to use it as a basis to fit my need.

Duncan

 Burhan Khalid wrote:

  Duncan wrote: 


    Hi, 

    I am trying to add a function to my template system where the script will output a 
similar name to the one entered, e.g.: 
    array('main','page1','testing','main_info'); 
    user input: 'mai' 
    then it should return 'main' & 'main_info' from the array as possible matches. 
(Ok, easy example, but it's supposed to work as well with worse typos) 

    Anyway, so I stumbled upon the levenshtein funtion which seems to be the right 
thing to use for s.th. like that. 

    However, how does on php.net the "search function" do it? Does it use a database 
match checking, or are they using some php function(s) to display matching function 
names? 


  I don't know how the search function (or google for that matter) do it, but a way to 
do it via SQL is "WHERE field LIKE mai%" 

  which will match main, mainly, mainstay, etc. 

  I would sure like to know how google does it. Maybe they use aspell? 

Reply via email to