substr
���������� ������� ������ � ������������ ������.
��������� :
string substr(string str, int start [,int length])
���������� ������� ������ str, ������� � ������� start � ������ length. ���� length �� ������, �� ��������������� ��������� �� start �� ����� ������ str. ���� start ������, ��� ����� ������, ��� �� �������� length ����� ����, �� ������������ ������ ���������.
������ ��� ������� ����� ������ � ��� �������� �������� ����. � �������, ���� �� ��������� � start ������������� �����, �� ����� ���������, ��� ��� ����� �������� �������� ���������, �� ������ ������������� �� ����� str (��������, -1 �������� "���������� � ���������� ������� ������").
�������� length, ���� �� �����, ���� ����� ���� �������������. � ���� ������ ��������� �������� ������������ ��������� ����� ������ �� str � �������� length, ������������ �� ����� ������.
���������� ������� ������ � ������������ ������.
��������� :
string substr(string str, int start [,int length])
���������� ������� ������ str, ������� � ������� start � ������ length. ���� length �� ������, �� ��������������� ��������� �� start �� ����� ������ str. ���� start ������, ��� ����� ������, ��� �� �������� length ����� ����, �� ������������ ������ ���������.
������ ��� ������� ����� ������ � ��� �������� �������� ����. � �������, ���� �� ��������� � start ������������� �����, �� ����� ���������, ��� ��� ����� �������� �������� ���������, �� ������ ������������� �� ����� str (��������, -1 �������� "���������� � ���������� ������� ������").
�������� length, ���� �� �����, ���� ����� ���� �������������. � ���� ������ ��������� �������� ������������ ��������� ����� ������ �� str � �������� length, ������������ �� ����� ������.
$str = substr("abcdef", 1); // ��������� "bcdef" $str = substr("abcdef", 1, 3); // ��������� "bcd" $str = substr("abcdef", -1); // ��������� "f" $str = substr("abcdef", -2); // ��������� "ef" $str = substr("abcdef", -3, 1); // ��������� "d" $str = substr("abcdef", 1, -1); // ��������� "bcde"
str_repeat
��������� ������ ������������ ���������� ���.
��������� :
string str_repeat(string str, int number)
������� "���������" ������ str number ��� � ���������� ������������ ���������.
��������� ������ ������������ ���������� ���.
��������� :
string str_repeat(string str, int number)
������� "���������" ������ str number ��� � ���������� ������������ ���������.
echo str_repeat("test!",3); // ������� test!test!test!
str_pad
��������� ������ ������ ������� �� ������������ �����.
��������� :
string str_pad(string input, int pad_length [, string pad_string [, int pad_type]])
�������� input ������ �������� ������. �������� pad_length ������ ����� ������������ ������. ���� �� ����� �������� ������, ��� �������� ������, �� �������� ���������� �� ������������.
��� ������ ��������������� ��������� pad_string ����� �������, ����� ������ ������������ � �������� ����������� (�� ��������� - �������).
��� ������ ��������������� ��������� pad_type ����� �������, � ����� ������� ������� ��������� ������: ������, ����� ��� � ����� ������.
���� �������� ����� ��������� ��������� ��������:STR_PAD_RIGHT (�� ���������)
STR_PAD_LEFT
STR_PAD_BOTH
��������� ������ ������ ������� �� ������������ �����.
��������� :
string str_pad(string input, int pad_length [, string pad_string [, int pad_type]])
�������� input ������ �������� ������. �������� pad_length ������ ����� ������������ ������. ���� �� ����� �������� ������, ��� �������� ������, �� �������� ���������� �� ������������.
��� ������ ��������������� ��������� pad_string ����� �������, ����� ������ ������������ � �������� ����������� (�� ��������� - �������).
��� ������ ��������������� ��������� pad_type ����� �������, � ����� ������� ������� ��������� ������: ������, ����� ��� � ����� ������.
���� �������� ����� ��������� ��������� ��������:
$str = "Aaaaa"; echo str_pad($str, 10); // ��������� "Aaaaa" echo str_pad($str, 10, "-=", STR_PAD_LEFT); // ��������� "-=-=-Aaaaa" echo str_pad($str, 10, "_", STR_PAD_BOTH) // ��������� "_Aaaa_"
chunk_split
���������� �������� ������.
��������� :
string chunk_split(string str [, int chunklen [, string end]])
������� chunk_split() ���������� ������, � ������� ����� ������ ������ ������ str ������ chunklen (�� ��������� 76) ����������� ������������������ ������������ end (�� ���������: "\r\n").
������ ������� ����� ���� ������� ��� ��������������� � ������ "base64" ��� ������������ �������� RFC 2045.
���������� �������� ������.
��������� :
string chunk_split(string str [, int chunklen [, string end]])
������� chunk_split() ���������� ������, � ������� ����� ������ ������ ������ str ������ chunklen (�� ��������� 76) ����������� ������������������ ������������ end (�� ���������: "\r\n").
������ ������� ����� ���� ������� ��� ��������������� � ������ "base64" ��� ������������ �������� RFC 2045.
// ������������� $data, ��������� ��������� RFC 2045 $str = chunk_split(base64_encode($data));��� ������� �������� ����������� �������, ��� ereg_replace().
strtok
���������� ������ �� ������.
��������� :
string strtok(string arg1, string arg2)
������ ���������� ����� ������ arg1 �� ����������� arg2. ��� ����������� ������� ������������ ��������� ����� �� ���������� �����������, � ��� �� ����� ������. ��� ������ ������ ������� ��������� ��� ���������: �������� ������ arg1 � ����������� arg2. ��� ������ ����������� ������ �������� arg1 ���������� �� ����, ����� ����� ������������ ������ ����� ������. ����� ���������� ������ ������, ������� ������ false. ���� ����� ������ ������� �� 0 ��� �� ������ ������, �� ������� ����� ������ false.
���������� ������ �� ������.
��������� :
string strtok(string arg1, string arg2)
������ ���������� ����� ������ arg1 �� ����������� arg2. ��� ����������� ������� ������������ ��������� ����� �� ���������� �����������, � ��� �� ����� ������. ��� ������ ������ ������� ��������� ��� ���������: �������� ������ arg1 � ����������� arg2. ��� ������ ����������� ������ �������� arg1 ���������� �� ����, ����� ����� ������������ ������ ����� ������. ����� ���������� ������ ������, ������� ������ false. ���� ����� ������ ������� �� 0 ��� �� ������ ������, �� ������� ����� ������ false.
$str="This is an example�string� Aaa"; $tok = strtok($str, " "); while($tok) { echo "$tok"; $tok = strtok(" �"); }; // �������: "This" "is" "an" "example" "string"���� ��������, ��� � �������� ������������ ����������� ������������������ ��������, ������ �� ������� � ����������� ����� �������� ������������, �� ����� � ������ ��������������� ����������� ��� ��� ����� ������������, ������� ���������� ������ ������ (��� ����� ���������� ���� ���������, ��� � �������).
explode
���������� ���������� ������ � ������.
��������� :
array explode(string seperator, string str [, int limit])
������� explode() ���������� ������ �����, ������ �� ������� ������������� ��������� �������� ������ str, ������������ ����� �������������, ���������� ���������� separator.
�������������� �������� limit ��������� ������������ ���������� ��������� � �������. ���������� ������������� ����� ����� ����������� � ��������� ��������.
���������� ���������� ������ � ������.
��������� :
array explode(string seperator, string str [, int limit])
������� explode() ���������� ������ �����, ������ �� ������� ������������� ��������� �������� ������ str, ������������ ����� �������������, ���������� ���������� separator.
�������������� �������� limit ��������� ������������ ���������� ��������� � �������. ���������� ������������� ����� ����� ����������� � ��������� ��������.
$str = "Path1 Path2 Path3 Path4"; $str_exp = explode(" ", $str); // ������ $str_exp = array([0] => Path1, [1] => Path2, // [2] => Path3, [3] => '', [4] => Path4)
implode
���������� ����������� ������� � ������.
��������� :
string implode(string glue, array pieces)
������� implode() ���������� ������, ������� �������� ��������������� ��� �������� �������, ��������� � ��������� pieces, ����� �������� ����������� ��������, ��������� � ��������� glue.
���������� ����������� ������� � ������.
��������� :
string implode(string glue, array pieces)
������� implode() ���������� ������, ������� �������� ��������������� ��� �������� �������, ��������� � ��������� pieces, ����� �������� ����������� ��������, ��������� � ��������� glue.
$str = implode(":", $arr);
join
���������� ����������� ������� � ������.
��������� :
string join(string glue, array pieces)
�� ��, ��� � implode().
���������� ����������� ������� � ������.
��������� :
string join(string glue, array pieces)
�� ��, ��� � implode().