Warning: include(../lntop.php) [function.include]: failed to open stream: No such file or directory in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 19

Warning: include() [function.include]: Failed opening '../lntop.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 19

Warning: include(../levoe_menu.php) [function.include]: failed to open stream: No such file or directory in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 46

Warning: include() [function.include]: Failed opening '../levoe_menu.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 46



Учебник РНР
НазадВперёд

htmlentities

(PHP 3, PHP 4)

htmlentities - конвертирует символы в мнемоники HTML.

Описание

string htmlentities (string string [, int quote_style [, string charset]])

Эта функция идентична htmlspecialchars(), но все символы, имеющие эквиваленты - мнемоники HTML, транслируются в эти мнемоники. Как и htmlspecialchars(), она принимает необязательный второй аргумент, указывающий, что должно выполняться с одинарными и двойными кавычками. ENT_COMPAT (по умолчанию) будет конвертировать только двойные кавычки и оставит одинарные без изменения. ENT_QUOTES будет конвертировать как двойные, так и одинарные кавычки, а ENT_NOQUOTES оставит и двойные, и одинарные кавычки без конвертации.

В настоящее время по умолчанию используется набор символов ISO-8859-1. Поддержка второго аргумента была введена в PHP 3.0.17 и в PHP 4.0.3.

Как и htmlspecialchars(), она принимает необязательный третий аргумент, который определяет набор символов, используемый при конвертации. Поддержка этого аргумента была введена в PHP 4.1.0.

Обратная функция отсутствует, но вы можете создать её сами. Вот пример того, как это сделать.

Пример 1. Реверсия htmlentities()
<?php
function unhtmlentities ($string)
{
	$trans_tbl = get_html_translation_table (HTML_ENTITIES);
	$trans_tbl = array_flip ($trans_tbl);
	return strtr ($string, $trans_tbl);
}
?>

См. также htmlspecialchars() и nl2br().


Назад Оглавление Вперёд
hebrevc Вверхhtmlspecialchars


Warning: include(../pravoe_menu.php) [function.include]: failed to open stream: No such file or directory in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 155

Warning: include() [function.include]: Failed opening '../pravoe_menu.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 155

Rambler's Top100
© 2009 Тест скорости интернета |  Boont.Ru

Warning: include(../lnbottom.php) [function.include]: failed to open stream: No such file or directory in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 281

Warning: include() [function.include]: Failed opening '../lnbottom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/prime/data/www/prime-speed.ru/Manual_PHP_4/f/htmlentities.html on line 281