Re: Fast prefix search?

From: Date: Sat, 13 Oct 2007 17:07:35 +0000
Subject: Re: Fast prefix search?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-263183@lists.php.net to get a copy of this message
On 10/14/07, Nathan Nobbe <quickshiftin@gmail.com> wrote: > can you use the php string manipulation functions ? I'll probably use strstr() to check whether a string starts with some prefix. But problem I like to solve is how to effectively pick strings starting with a prefix from a large dataset, like a dictionary. If Berkeley DB's set_range were available from PHP, I could write something like $word = dba_set_range($prefix, $dictionary) // get the first word starting with $prefix do { if (!prefix($word) == $prefix) break $found[] = $word } while ($word = dba)_nextkey($dictionary))

« previous php.general (#263183) next »