Page 1 of 1
finding similarities in array
Posted: Mon Aug 15, 2005 7:06 am
by shiznatix
is there a way to use the awesome mysql LIKE function on arrays in php? i need to find elements of an array that are going to be simmilar to eachother
Posted: Mon Aug 15, 2005 7:20 am
by feyd
there isn't an efficient way.. but you can make your own in php fairly easily... hint:
strtolower()
strstr()
Posted: Mon Aug 15, 2005 8:14 am
by Weirdan
Take a look at chapter on array functions in php manual.
f.e.
array_filter,
usort,
array_walk. Using these functions + some regexps you're certainly able to implement LIKE and alike in php

Posted: Mon Aug 15, 2005 9:07 am
by josh
There's probably already functions out there for returning the % of similarity between 2 strings.
Posted: Mon Aug 15, 2005 10:17 am
by feyd
yes, there are.. but they tend to.. shall we say, be expensive (in execution time)