Edit report at https://bugs.php.net/bug.php?id=36261&edit=1
ID: 36261
Comment by: dejaschinski at googlemail dot com
Reported by: mac30 at narod dot ru
Summary: similar_text parameters aren't convertible
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: linux - kernel 2.6
PHP Version: 4.4.2
Block user comment: N
Private report: N
New Comment:
I've running in the same problem. I'm using php-5.3.6 with opensuse11.3.
<?php
echo similar_text("test","wert");
echo "|";
echo similar_text("wert","test");
Expected result:
2|2
Current result:
1|2
Previous Comments:
------------------------------------------------------------------------
[2006-02-02 16:41:52] mac30 at narod dot ru
Description:
------------
Hi! I have some problems with similar_text() function.
In most cases using similar_text(s1,s2) and similar_text(s2,s1) I get the same
results. For example:
(format: s1-first_string, s2-second_string,
similar_text(s1,s2) (percents%)
similar_text(s2,s1) (percents%)
ziga piekierski 1 (14.3%), 1 (14.3%)
sadlowski piekierski 3 (31.6%), 3 (31.6%),
ogorek piekierski 2 (25.0%), 2 (25.0%)
majeski piekierski 4 (47.1%), 4 (47.1%),
They gives the same results regardless I use s1,s2 or s2,s1. But in some case I
gets different results and I don't know why:
natujeszczak piekierski 2 (18.2%), 3 (27.3%)
andrzejewski piekierski 5 (45.5%), 4 (36.4%)
michaelski pankanin 3 (33.3%), 1 (11.1%)
cegielski pankanin 2 (23.5%), 1 (11.8%)
I used PHP 4.4.0 and 5.0.5 and got exactly the same results on both of them.
I find similar_text function very useful and that's a pity it's not reliable,
because I don't know which value (of the two) is correct.
Using LCS function (taken from comments on similar_text manual page) I was
always getting the same results for (s1,s2) and (s2,s1) - always the higher
value of similar_text(s1,s2) and similar_text(s2,s1)
Best Regards
Maciej
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=36261&edit=1