����������
WEB - ������

www.spravkaweb.ru Rambler's Top100
 ï¿½ï¿½ ����������: �������/PHP/��������� �������.������� ���������Ðàñïå÷àòàòü 
�������
�������
����� ���
HTML
JavaScript
VBScript
CSS
Flash
Perl
PHP
MySQL
SSI
VRML
�������������
������
Download
�����
��������
������
�������� ���
�����:
��������
Subscribe.Ru:

PHP

<--����� | ��������� � ������ | ������-->
��������� �������
������� ���������
strcmp
���������� ������.

��������� :
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.
��� ��� ��������� ���� ���������, �� ������� �������� ������ �� ���������� ���������.

strcasecmp
���������� ������ ��� ����� ��������.

��������� :
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().

strnatcmp
���������� "������������" ��������� �����.

��������� :
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(), ������ ���������� �������.

similar_text
���������� ����������� �������� ���� �����.

��������� :
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, �� ����� ����� ����� ��� ����������.
  • �� ���������� ����� ����� ������� "PHP 4. ����������� ����������."
    www.piter.com
    ������ / � ����������
     
    Download
    Ñêà÷àòü ñïðàâî÷íèê ïî PHP
    ��� ������:
    05.07.2004
  • � ������� PHP ��������� ��������� ������� ��� ������ � ���������� (���������� GD):
    imagetypes(), ...
  • � ������� JavaScript ��������� �������� �� ����� D, E, F, H, I
  • � ������� ������ ��������� ������, �������������� ��� �������� � html-�������� ��������� MS Office (Word, Excel � �.�.)
  • �����������:
    ���� ������ � �����:
    ������ �����!
    ����������.
    ��� ����.
    ��� ��� �����.
    ������.
    ���� �� �����!
    ��������:
    Rambler's Top100
    Ñäåëàòü ñòðàíèöó ñòàðòîâîé ������� �������� ���������
    Äîáàâèòü ñòðàíèöó â èçáðàííîå �������� ���� � ���������
    Ñîîáùèòü îá íàéäåííîé îøèáêå �������� �� ������