mirror of
https://github.com/php/doc-ru.git
synced 2026-03-26 00:32:15 +01:00
172 lines
5.3 KiB
XML
172 lines
5.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: a3db55f0df6a17d473f65ce207ef3f778011cdfe Maintainer: tmn Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.mb-encode-numericentity" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<refnamediv>
|
||
<refname>mb_encode_numericentity</refname>
|
||
<refpurpose>Кодирует символ в числовую HTML-ссылку</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>string</type><methodname>mb_encode_numericentity</methodname>
|
||
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
||
<methodparam><type>array</type><parameter>map</parameter></methodparam>
|
||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
|
||
<methodparam choice="opt"><type>bool</type><parameter>hex</parameter><initializer>&false;</initializer></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Функция преобразовывает заданные коды символов в строке (<type>string</type>)
|
||
<parameter>string</parameter> из кодов в числовые HTML-ссылки.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>string</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Кодируемая строка (<type>string</type>).
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>map</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Параметр <parameter>map</parameter> — массив, задающий область кода для преобразования.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>encoding</parameter></term>
|
||
<listitem>
|
||
&mbstring.encoding.parameter;
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>hex</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Должна ли возвращаемая на сущность ссылка быть в
|
||
шестнадцатеричной нотации (иначе она будет в десятичной).
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Функция возвращает преобразованную строку (<type>string</type>).
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="changelog">
|
||
&reftitle.changelog;
|
||
<informaltable>
|
||
<tgroup cols="2">
|
||
<thead>
|
||
<row>
|
||
<entry>&Version;</entry>
|
||
<entry>&Description;</entry>
|
||
</row>
|
||
</thead>
|
||
<tbody>
|
||
&mbstring.changelog.encoding-nullable;
|
||
</tbody>
|
||
</tgroup>
|
||
</informaltable>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования параметра <parameter>map</parameter></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$convmap = array (
|
||
int start_code1, int end_code1, int offset1, int mask1,
|
||
int start_code2, int end_code2, int offset2, int mask2,
|
||
........
|
||
int start_codeN, int end_codeN, int offsetN, int maskN );
|
||
// Задайте значения Юникода для start_codeN и end_codeN
|
||
// Добавьте к значению offsetN и сложите побитово с maskN,
|
||
// затем преобразуйте результат в число.
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
|
||
<para>
|
||
<example>
|
||
<title>Пример использования функции <function>mb_encode_numericentity</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
/* Преобразование левой части ISO-8859-1 в числовую HTML-ссылку */
|
||
$convmap = array(0x80, 0xff, 0, 0xff);
|
||
$str = mb_encode_numericentity($str, $convmap, "ISO-8859-1");
|
||
|
||
/* Преобразование заданного пользователем кода SJIS-win в блоке 95-104 в числовую ссыку*/
|
||
$convmap = array(
|
||
0xe000, 0xe03e, 0x1040, 0xffff,
|
||
0xe03f, 0xe0bb, 0x1041, 0xffff,
|
||
0xe0bc, 0xe0fa, 0x1084, 0xffff,
|
||
0xe0fb, 0xe177, 0x1085, 0xffff,
|
||
0xe178, 0xe1b6, 0x10c8, 0xffff,
|
||
0xe1b7, 0xe233, 0x10c9, 0xffff,
|
||
0xe234, 0xe272, 0x110c, 0xffff,
|
||
0xe273, 0xe2ef, 0x110d, 0xffff,
|
||
0xe2f0, 0xe32e, 0x1150, 0xffff,
|
||
0xe32f, 0xe3ab, 0x1151, 0xffff );
|
||
$str = mb_encode_numericentity($str, $convmap, "sjis-win");
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>mb_decode_numericentity</function></member>
|
||
</simplelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
</refentry>
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|