Files
php-doc-ru/reference/misc/functions/php-strip-whitespace.xml
Sergey Panteleev daef8df962 Обнуление тега Reviewed (#364)
[skip-lint]
[skip-spellcheck]
2021-11-16 13:03:53 +03:00

110 lines
3.4 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: f9c4a68ef4f89e51e6d9b905ad3ddb6492386dd3 Maintainer: bfl Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.php-strip-whitespace" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>php_strip_whitespace</refname>
<refpurpose>Возвращает исходный код без комментариев и пробелов</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>php_strip_whitespace</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
Возвращает исходный код PHP в файл (<parameter>filename</parameter>) с удалёнными
комментариями и пробелами. Эта функция может быть полезной для определения
фактичного объёма чистого кода в скриптах по сравнению с количеством комментариев.
Функция аналогична использованию <command>php -w</command> из
<link linkend="features.commandline">командной строки</link>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
Путь к файлу PHP.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает очищенный исходный код в случае успешного выполнения или пустую строку в случае возникновения ошибки.
</para>
<note>
<para>
Эта функция принимает во внимание значение INI-директивы
<link linkend="ini.short-open-tag">short_open_tag</link>.
</para>
</note>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>php_strip_whitespace</function></title>
<programlisting role="php">
<![CDATA[
<?php
// PHP комментарий
/*
* Другой PHP комментарий
*/
echo php_strip_whitespace(__FILE__);
// Символы новой строки считаются пробелами, и также удаляются:
do_nothing();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<?php
echo php_strip_whitespace(__FILE__); do_nothing(); ?>
]]>
</screen>
<para>
В результате выполнения примера выведен исходный код PHP без
комментариев, пробелов и пустых строк.
</para>
</example>
</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
-->