strcmp
���������� ������.
��������� :
int strcmp(string str1, string str2)
��� ������� ���������� ��� ������ ����������� (������, ���������) � ����������:
0 - ���� ������ ��������� ���������;
-1 - ���� ������ str1 ����������������� ������ str2;
1 - ����, ��������, str1 "������" str2.
��� ��� ��������� ���� ���������, �� ������� �������� ������ �� ���������� ���������.
���������� ������.
��������� :
int strcmp(string str1, string str2)
��� ������� ���������� ��� ������ ����������� (������, ���������) � ����������:
0 - ���� ������ ��������� ���������;
-1 - ���� ������ str1 ����������������� ������ str2;
1 - ����, ��������, str1 "������" str2.
��� ��� ��������� ���� ���������, �� ������� �������� ������ �� ���������� ���������.
strncmp
���������� ������ �����.
��������� :
int strncmp(string str1, string str2, int len)
��� ������� ���������� �� strcmp() ���, ��� ���������� �� ��� ����� �������, � ������ len ������. � ������, ���� len ������ ����� ���������� �� �����, �� ������ ������������ �������.
��� ������� ���������� ��� ������ ����������� (������, ���������) � ����������:
0 - ���� ������ ��������� ���������;
-1 - ���� ������ str1 ����������������� ������ str2;
1 - ����, ��������, str1 "������" str2.
��� ��� ��������� ���� ���������, �� ������� �������� ������ �� ���������� ���������.
���������� ������ �����.
��������� :
int strncmp(string str1, string str2, int len)
��� ������� ���������� �� strcmp() ���, ��� ���������� �� ��� ����� �������, � ������ len ������. � ������, ���� len ������ ����� ���������� �� �����, �� ������ ������������ �������.
��� ������� ���������� ��� ������ ����������� (������, ���������) � ����������:
0 - ���� ������ ��������� ���������;
-1 - ���� ������ str1 ����������������� ������ str2;
1 - ����, ��������, str1 "������" str2.
��� ��� ��������� ���� ���������, �� ������� �������� ������ �� ���������� ���������.
strcasecmp
���������� ������ ��� ����� ��������.
��������� :
int strcasecmp(string str1, string str2)
�� �� �����, ��� � strcmp(), ������ ��� ������ �� ����������� ������� ����.
���������� ������ ��� ����� ��������.
��������� :
int strcasecmp(string str1, string str2)
�� �� �����, ��� � strcmp(), ������ ��� ������ �� ����������� ������� ����.
$str1 = "������!"; $str2 = "������!"; if(!strcesecmp($str1, $str2)) echo "$str1 == $str2 ��� ��������� ����� ��� ����� ��������";
strncasecmp
���������� ������ ����� ��� ����� ��������.
��������� :
int strncasecmp(string str1, string str2, int len)
������� strncasecmp() �������� ����������� ������� strcasecmp() � strncmp().
���������� ������ ����� ��� ����� ��������.
��������� :
int strncasecmp(string str1, string str2, int len)
������� strncasecmp() �������� ����������� ������� strcasecmp() � strncmp().
strnatcmp
���������� "������������" ��������� �����.
��������� :
int strnatcmp(string str1, string str2)
������ ������� ��������� ��������� �����, ������� ����������� �� �������.
���������� "������������" ��������� �����.
��������� :
int strnatcmp(string str1, string str2)
������ ������� ��������� ��������� �����, ������� ����������� �� �������.
$arr1 = $arr2 = array("img12.png", "img10.png", "img2.png", "img1.png"); echo "������� ����������\n"; usort($arr1, "strcmp"); print_r($arr1); echo "\n������������� ����������\n"; usort($arr2, "strnatcmp"); print_r($arr2);������ ������� ������� ���������:
������� ���������� Array ( [0] => img1.png [1] => img10.png [2] => img12.png [3] => img2.png ) ������������ ���������� Array ( [0] => img1.png [1] => img2.png [2] => img10.png [3] => img12.png )
strnatcasecmp
���������� "������������" ��������� ����� ��� ����� ��������.
��������� :
int strnatcasecmp(string str1, string str2)
�� ��, ��� � strnatcmp(), ������ ���������� �������.
���������� "������������" ��������� ����� ��� ����� ��������.
��������� :
int strnatcasecmp(string str1, string str2)
�� ��, ��� � strnatcmp(), ������ ���������� �������.
similar_text
���������� ����������� �������� ���� �����.
��������� :
int similar_text(string firsrt, string second [, double percent])
������� similar_text() ��������� �������� ���� ����� �� ���������, ���������� �������� (Oliver [1993]). �� ������ ����� (��� � ���������� �������) ��� ���������� ����������� ������.
��������� ��������� ������ ������� ���������, � �� �������� ��������������� (N^3), ��� N - ����� ���������� ������.
������� ���������� ����� ��������, ��������� � ����� �������. ��� �������� �� ������ �������� ��������������� ��������� � ��� ����������� ������� ���������� �����.
���������� ����������� �������� ���� �����.
��������� :
int similar_text(string firsrt, string second [, double percent])
������� similar_text() ��������� �������� ���� ����� �� ���������, ���������� �������� (Oliver [1993]). �� ������ ����� (��� � ���������� �������) ��� ���������� ����������� ������.
��������� ��������� ������ ������� ���������, � �� �������� ��������������� (N^3), ��� N - ����� ���������� ������.
������� ���������� ����� ��������, ��������� � ����� �������. ��� �������� �� ������ �������� ��������������� ��������� � ��� ����������� ������� ���������� �����.
levenshtein
����������� �������� ����������� ���� �����.
��������� :
int levenshtein(string str1, string str2)
int levenshtein(string str1, string str2, int cost_ins, int cost_rep, int cost_del)
int levenshtein(string str1, string str2, function cost)
"�������� �����������" - ��� ����������� ���� ��������, ������� ����������� �� ��������, �������� ��� ������� ��� ����, ����� ���������� ������ str1 � str2. ��������� ��������� ��������������� ������������ ���� ����� str1 � str2, ��� ������ ������� ����� �����������������, ��� similar_text().
������ ����� ������� ���������� ����� ����������� �������� ��� ��������� ����� ��� ������������� str1 � str2.
������ ������ ����� ��� �������������� ���������: ��������� �������� �������, ������ � ��������, ��� ������ �� ����� �������������� ��� ����������, �� ��� ���� ����� �����������������. ������������ ������������ ���������� ��������� �������������.
������ ������� ��������� ������� �������, ������������ ��� ������� ��������� �������������. ������� cost ���������� �� ���������� �����������:����������� �������� (��������, ��������, �������): "I*quot;, "R", "D";
����������� ������ ������ ������
����������� ������ ������ ������
������� ������ 1
������� ������ 2
���������� ����� ������ 1
���������� ����� ������ 2
���������� ������� ������ ����� ���������� ��������� ���� ��������.
���� ����� ����� �� ����� ����� 255 ��������, ������� levenshtein() ���������� -1, �� ����� ����� ����� ��� ����������.
����������� �������� ����������� ���� �����.
��������� :
int levenshtein(string str1, string str2)
int levenshtein(string str1, string str2, int cost_ins, int cost_rep, int cost_del)
int levenshtein(string str1, string str2, function cost)
"�������� �����������" - ��� ����������� ���� ��������, ������� ����������� �� ��������, �������� ��� ������� ��� ����, ����� ���������� ������ str1 � str2. ��������� ��������� ��������������� ������������ ���� ����� str1 � str2, ��� ������ ������� ����� �����������������, ��� similar_text().
������ ����� ������� ���������� ����� ����������� �������� ��� ��������� ����� ��� ������������� str1 � str2.
������ ������ ����� ��� �������������� ���������: ��������� �������� �������, ������ � ��������, ��� ������ �� ����� �������������� ��� ����������, �� ��� ���� ����� �����������������. ������������ ������������ ���������� ��������� �������������.
������ ������� ��������� ������� �������, ������������ ��� ������� ��������� �������������. ������� cost ���������� �� ���������� �����������:
���������� ������� ������ ����� ���������� ��������� ���� ��������.
���� ����� ����� �� ����� ����� 255 ��������, ������� levenshtein() ���������� -1, �� ����� ����� ����� ��� ����������.