<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.strip-tags.php',
    1 => 'strip_tags',
    2 => 'Видаляє HTML і PHP-теги з рядка',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Функції',
  ),
  'prev' => 
  array (
    0 => 'function.strcspn.php',
    1 => 'strcspn',
  ),
  'next' => 
  array (
    0 => 'function.stripcslashes.php',
    1 => 'stripcslashes',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'uk',
    'path' => 'reference/strings/functions/strip-tags.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strip-tags" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strip_tags</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strip_tags</span> &mdash; <span class="dc-title">Видаляє HTML і PHP-теги з рядка</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.strip-tags-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>strip_tags</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$allowable_tags</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Ця функція намагається повернути рядок <code class="parameter">str</code> з усіма видаленими
   NULL-байтами, HTML та PHP тегами.  Для видалення використовується той же
   рушій, що й у функції <span class="function"><a href="function.fgetss.php" class="function">fgetss()</a></span>.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.strip-tags-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">str</code></dt>
     <dd>
      <p class="para">
       Вхідний рядок.
      </p>
     </dd>
    
    
     <dt><code class="parameter">allowable_tags</code></dt>
     <dd>
      <p class="para">
       Ви можете використовувати необов&#039;язковий другий параметр, щоб вказати теги,
       які не повинні видалятись.
      </p>
      <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
       <p class="para">
        HTML-коментарі та PHP-теги будуть видалені в усякому разі. Це прописано у коді та
        не може бути змінено за допомогою <code class="parameter">allowable_tags</code>.
       </p>
      </p></blockquote>
      <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
       <p class="para">
        Цей параметр не повинен містити пробілів.
        <span class="function"><strong>strip_tags()</strong></span> розглядає тег як нечутливий до регістру
        рядок, який знаходиться між <code class="literal">&lt;</code> та першим пробілом, або
        <code class="literal">&gt;</code>. Це означає, що
        <code class="literal">strip_tags(&quot;&lt;br/&gt;&quot;, &quot;&lt;br&gt;&quot;)</code> поверне пустий рядок.
       </p>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.strip-tags-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає рядок без тегів.
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.strip-tags-changelog">
  <h3 class="title">Журнал змін</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Версія</th>
       <th>Опис</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.0</td>
       <td>
        <span class="function"><strong>strip_tags()</strong></span> тепер безпечна для бінарних даних.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.strip-tags-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 Викоритання <span class="function"><strong>strip_tags()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$text </span><span style="color: #007700">= </span><span style="color: #DD0000">'&lt;p&gt;Абзац.&lt;/p&gt;&lt;!-- Коментар --&gt; &lt;a href="#fragment"&gt;Якийсь текст&lt;/a&gt;'</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">strip_tags</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Дозволяємо теги &lt;p&gt; та &lt;a&gt;<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">strip_tags</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">, </span><span style="color: #DD0000">'&lt;p&gt;&lt;a&gt;'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Абзац. Якийсь текст
&lt;p&gt;Абзац.&lt;/p&gt; &lt;a href=&quot;#fragment&quot;&gt;Якийсь текст&lt;/a&gt;</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 notes" id="refsect1-function.strip-tags-notes">
  <h3 class="title">Примітки</h3>
  <div class="warning"><strong class="warning">Увага</strong>
   <p class="para">
    Оскільки <span class="function"><strong>strip_tags()</strong></span> не перевіряє HTML-документ на валідність,
    часткові або зламані теги можуть призвести до видалення більших об&#039;ємів
    тексту/інформації аніж очікувалося.
   </p>
  </div>
  <div class="warning"><strong class="warning">Увага</strong>
   <p class="para">
    Ця функція не змінює атрибутів у тегах, які ви дозволили
    за допомогою <code class="parameter">allowable_tags</code>, включаючи атрибути
    <code class="literal">style</code> та <code class="literal">onmouseover</code>,
    які шкідливий користувач може розмістити для відображення іншим користувачам. 
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    Імена тегів у HTML, які перевищують довжину в 1023 байта 
    будуть розглядатися як невалідні незалежно від параметра 
    <code class="parameter">allowable_tags</code>.
   </p>
  </p></blockquote>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.strip-tags-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.htmlspecialchars.php" class="function" rel="rdfs-seeAlso">htmlspecialchars()</a> - Convert special characters to HTML entities</span></li>
   </ul>
  </p>
 </div>

 
</div><?php manual_footer($setup); ?>