note 105488 added to function.similar-text
| From: | lukasamdatgmaildotcom at osu1 dot php dot net | Date: | Mon, 22 Aug 2011 11:19:58 +0000 |
| Subject: | note 105488 added to function.similar-text | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182635@lists.php.net to get a copy of this message | ||
According to romain dot boyer at gmail dot com 08-Aug-2007 12:59:
"
Like levenchtein(), You can do :
(strlen($string2) - similar_text($string,$string2))
to see how much characters have been changed.
"
Yes, but we have to remember about strings length - if first string is longer, we must substract
from first length, if not, from second:
<?php
$string_first = 'Lorem ipsum';
$string_new = 'Lorem dolor';
$length_string_first = strlen($string_first);
$length_string_new = strlen($string_new);
if ($length_string_first > $length_string_new)
{
$changed_chars = ($length_string_first - similar_text($string_first, $string_new));
}
else
{
$changed_chars = ($length_string_new - similar_text($string_first, $string_new));
}
?>
----
Server IP: 195.114.0.19
Probable Submitter: 83.4.113.81
----
Manual Page -- http://www.php.net/manual/en/function.similar-text.php
Edit -- https://master.php.net/note/edit/105488
Del: integrated -- https://master.php.net/note/delete/105488/integrated
Del: useless -- https://master.php.net/note/delete/105488/useless
Del: bad code -- https://master.php.net/note/delete/105488/bad+code
Del: spam -- https://master.php.net/note/delete/105488/spam
Del: non-english -- https://master.php.net/note/delete/105488/non-english
Del: in docs -- https://master.php.net/note/delete/105488/in+docs
Del: other reasons-- https://master.php.net/note/delete/105488
Reject -- https://master.php.net/note/reject/105488
Search -- https://master.php.net/manage/user-notes.php