set_time_limit
��������� ����������� ������� ���������� ��������.
��������� :
void set_time_limit(int seconds)
��� ������� �������� PHP ��������� ��������� ������, � ���� ����� (���������� �������� ��� ����������) ��������, � �������� ��� �� ����������, PHP ������������� ��������� �������� (��������� ��������� ������ ����������). ��� �� ��������� ��������� �������� ���������� ���������, ����������� ������� �������, ��, ����������, "��������" (��������, ���� � ��� ����������� ����������� ���� ��� ��� �������� ��������� ����������� � ������������� �������).
�� ��������� ���������� ����� ���������� �������� ��������������� � ����� ������������ ���������� max_execution_time (������ ��� ����� 30 �). �� ��� �������� �������� ��� ����� ����� �������� ������� ������ �������, ������ ����� � �������� � �� ���������. ���� ����������� �������� 0, �� ����� ��������� ����������� ���������.
������ ������� ���������� �� ������� ������ �������. ��������, ���� �������� ��� ���������� � ������� 15 ������, � ����� ���������� ������� set_time_limit(20), �� ����� ������������ ����� ���������� �������� ���������� ������ 35 ��������.
���� �������� ����������� � ���������� ������ (� ������������� ���������� safe mode), �� ����� ����� ���� ������� ������������ � ������������ �������� �� ����� ������������.
��������� ����������� ������� ���������� ��������.
��������� :
void set_time_limit(int seconds)
��� ������� �������� PHP ��������� ��������� ������, � ���� ����� (���������� �������� ��� ����������) ��������, � �������� ��� �� ����������, PHP ������������� ��������� �������� (��������� ��������� ������ ����������). ��� �� ��������� ��������� �������� ���������� ���������, ����������� ������� �������, ��, ����������, "��������" (��������, ���� � ��� ����������� ����������� ���� ��� ��� �������� ��������� ����������� � ������������� �������).
�� ��������� ���������� ����� ���������� �������� ��������������� � ����� ������������ ���������� max_execution_time (������ ��� ����� 30 �). �� ��� �������� �������� ��� ����� ����� �������� ������� ������ �������, ������ ����� � �������� � �� ���������. ���� ����������� �������� 0, �� ����� ��������� ����������� ���������.
������ ������� ���������� �� ������� ������ �������. ��������, ���� �������� ��� ���������� � ������� 15 ������, � ����� ���������� ������� set_time_limit(20), �� ����� ������������ ����� ���������� �������� ���������� ������ 35 ��������.
���� �������� ����������� � ���������� ������ (� ������������� ���������� safe mode), �� ����� ����� ���� ������� ������������ � ������������ �������� �� ����� ������������.
sleep
�������� ���������� ��������.
��������� :
void sleep(int seconds);
������ sleep() ��������� �������� ��������� �������� � �������� (seconds).
�������� ���������� ��������.
��������� :
void sleep(int seconds);
������ sleep() ��������� �������� ��������� �������� � �������� (seconds).
usleep
�������� ���������� �������� � �������������.
��������� :
void usleep(int micro_seconds);
�������� ���������� �������� � ������������� (micro_seconds).
��� ������� �� �������� � Windows.
�������� ���������� �������� � �������������.
��������� :
void usleep(int micro_seconds);
�������� ���������� �������� � ������������� (micro_seconds).
��� ������� �� �������� � Windows.
die
����� ��������� � ���������� �������� ��������.
��������� :
void die(string message);
��� ������� ������� ��������� � ���������� ���������� �������� �������. �� ���������� ��������.
����� ��������� � ���������� �������� ��������.
��������� :
void die(string message);
��� ������� ������� ��������� � ���������� ���������� �������� �������. �� ���������� ��������.
<?php $filename = '/path/to/data-file'; $file = fopen($filename, 'r') or die "unable to open file ($filename)"; ?>
exit
��������� ������� ��������.
��������� :
void exit(void);
��� ������� ��������� ������� ��������. �� ���������� ��������.
��������� ������� ��������.
��������� :
void exit(void);
��� ������� ��������� ������� ��������. �� ���������� ��������.
assert
�������� ���������� ��������.
��������� :
int assert(string|bool assertion);
� �������� ��������� ������� ����� ���� ������� �������� ��� ������, ���������� ��� PHP (��� � ������� eval()). ������� ���������, �������� �� �������� (��� ���������) ������ false, �, ���� ��� ���, ��������� ������������ ��������.
��������� ������� ������������ ����������� � ����� ������������ ��� ��� ������ ������� assert_options().
������ ��� ������� ������������ ������������� � ����� �������, ��� �������� ��� ��������, ������� ������ ������ ���� ������� (��������: ����������� ������, ��������� ������������ �� ����� � �.�.).
� ����� �� ���������� �������� �� ������ �������� �� ����� ��������, � ������������ ������� �������� ������������ ��������� ��������.
a: 1
Warning: Assertion failed in file.php on line 20
0
* Failed *
�������� ���������� ��������.
��������� :
int assert(string|bool assertion);
� �������� ��������� ������� ����� ���� ������� �������� ��� ������, ���������� ��� PHP (��� � ������� eval()). ������� ���������, �������� �� �������� (��� ���������) ������ false, �, ���� ��� ���, ��������� ������������ ��������.
��������� ������� ������������ ����������� � ����� ������������ ��� ��� ������ ������� assert_options().
������ ��� ������� ������������ ������������� � ����� �������, ��� �������� ��� ��������, ������� ������ ������ ���� ������� (��������: ����������� ������, ��������� ������������ �� ����� � �.�.).
� ����� �� ���������� �������� �� ������ �������� �� ����� ��������, � ������������ ������� �������� ������������ ��������� ��������.
<?php function handler() { echo "\n* Failed * \n"; } assert("\$a='1';"); echo "a: $a \n"; assert(0); // ��������� �������� echo assert_options(ASSERT_BAIL, 1); // ������� ���������� assert_options(ASSERT_CALLBACK, "handler"); // �� �������� ��������� PHP @assert(--$a); // ��� ������ �� ����� ��������� echo "\n ... \n"����������� ������ �������:
a: 1
Warning: Assertion failed in file.php on line 20
0
* Failed *
assert_options
����������� ���������� assert.
��������� :
mixed assert_options(int parameter [, mixed value])
��� ������� ��������� ���������� ��������� ����������� assert(). ������������ ���������� �������� ��������� (��� �������� false ��� ������), ���������� � ������ ��������� ����� �� ��������� ��������:
���� �������� ���������� ��������������, ��� ��������� �� ������ ���������.
����������� ���������� assert.
��������� :
mixed assert_options(int parameter [, mixed value])
��� ������� ��������� ���������� ��������� ����������� assert(). ������������ ���������� �������� ��������� (��� �������� false ��� ������), ���������� � ������ ��������� ����� �� ��������� ��������:
�������� | ini-�������� | ��������� | �������� |
ASSERT_ACTIVE | asser.active | 1 | ��������� �������� ���� � assert(). |
ASSERT_WARNING | assert.warning | 1 | �������� �������������� PHP. |
ASSERT_BAIL | assert.bail | 0 | ��������� ����������, ���� "���������". |
ASSERT_QUIET_EVAL | assert.quiet_eval | 0 | �� �������� ���������. |
ASSERT_CALLBACK | assert_callback | (null) | ���������� ������� � �������� ����������� "����������" assert(). |
���� �������� ���������� ��������������, ��� ��������� �� ������ ���������.
eval
���������� ���������� ������ ���������� PHP ���.
��������� :
void eval(string code_str);
������� eval() ���������� ���������� ������, �������� � code_str ���������� PHP ���. ������, ��� ����� ����������� ��� ���������� ���� � ��������� ���� ���� ������ ��� ����� �������� ����������. �� ���������, ��� ��������� � ������ ��� ������ ���� ������������� ���������� (��������, ������ �������������� ����� � ������� ����� ������ ������� � �.�.), � ��������� ������ �������� ����� �������� � ���� ������ � �������. ���������� �����, ��� �� �������� ����������, ������� ����� ����������� � ������ ������, ����� �������������� � ���������� ����� ��������.
��� ��������� ���������� �������� � eval() ��� ���������� ����� �������� � � �������� ������.
���� � ������ ������ �������� return, �� ����� ���������� ���������� ���� ����� �������� ��������� � ������������ �������� ����� ����� �������� ��� ��������, ������������ ����� �������.
This is a $string with my $name in it.
This is a cup with my coffee in it.
���������� ���������� ������ ���������� PHP ���.
��������� :
void eval(string code_str);
������� eval() ���������� ���������� ������, �������� � code_str ���������� PHP ���. ������, ��� ����� ����������� ��� ���������� ���� � ��������� ���� ���� ������ ��� ����� �������� ����������. �� ���������, ��� ��������� � ������ ��� ������ ���� ������������� ���������� (��������, ������ �������������� ����� � ������� ����� ������ ������� � �.�.), � ��������� ������ �������� ����� �������� � ���� ������ � �������. ���������� �����, ��� �� �������� ����������, ������� ����� ����������� � ������ ������, ����� �������������� � ���������� ����� ��������.
��� ��������� ���������� �������� � eval() ��� ���������� ����� �������� � � �������� ������.
���� � ������ ������ �������� return, �� ����� ���������� ���������� ���� ����� �������� ��������� � ������������ �������� ����� ����� �������� ��� ��������, ������������ ����� �������.
<?php $string = 'cup'; $name = 'coffee'; $str = 'This is a $string with my $name in it.����������� ���������� ����� ���� �����:
'; echo $str; eval( "\$str = \"$str\";" ); echo $str; ?>
This is a $string with my $name in it.
This is a cup with my coffee in it.