Files
php-doc-ru/reference/misc/functions/highlight-string.xml
Mikhail Alferov 6894932ef2 Update reference/misc/functions to En (#997)
* Update die.xml to en

* language-snippets.ent Формулировки

* Update highlight-string.xml to en

* Update exit.xml to en

* Update exit.xml fix xml syntax syntax error
2024-11-19 14:32:35 +03:00

161 lines
4.9 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ba50f222e7108287fb6eb11265c2b28efe0cc0ce Maintainer: bfl Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.highlight-string" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>highlight_string</refname>
<refpurpose>Подсвечивает синтаксис строки PHP-кода</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>true</type></type><methodname>highlight_string</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>return</parameter><initializer>&false;</initializer></methodparam>
</methodsynopsis>
<simpara>
Функция выводит или возвращает HTML-разметку версии PHP-кода c подсветкой синтаксиса.
Функция подсвечивает разметку цветами, которые определили во встроенном обработчике
подсветки синтаксиса для PHP.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
PHP-код, который требуется подсветить. Код должен включать открывающий тег.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>return</parameter></term>
<listitem>
<para>
В аргументе передают значение &true;, чтобы функция не выводила, а возвращала код,
который подсветила.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Функция не выводит, а возвращает код с подсветкой синтаксиса в виде строки,
если для параметра <parameter>return</parameter> установили значение &true;.
В остальных случаях функция возвращает значение &true;.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Тип значения возврата изменили со <type class="union"><type>string</type><type>bool</type></type>
на <type class="union"><type>string</type><type>true</type></type>.
</entry>
</row>
<row>
<entry>8.3.0</entry>
<entry>
Изменилась результирующая HTML-разметка.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример подсветки PHP-синтаксиса функцией <function>highlight_string</function></title>
<programlisting role="php">
<![CDATA[
<?php
highlight_string('<?php phpinfo(); ?>');
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span>
</span>
</code>
]]>
</screen>
&example.outputs.83;
<screen>
<![CDATA[
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span></code></pre>
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.uses-ob;
<para>
В будущем возможно изменение HTML-разметки, которую генерирует функция.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>highlight_file</function></member>
<member><link linkend="ini.syntax-highlighting">Подсветка INI-директив</link></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
-->