NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - strip_tags

Trieda

Koreň \ Bez triedy

Metóda - strip_tags

(PHP 4, PHP 5, PHP 7)

The function strip_tags() removes HTML tags, PHP tags and HTML comments from a string. The function works as that it removes all characters between < and > without taking care of lowercase or uppercase.

Look out! Using the function strip_tags() at invalid HTML can cause removing a part of the content. It keeps attributes in allowed tags, too.

Procedurálne

  • function strip_tags (string $str, string $allowable_tags) : string

Parametre

NázovDátový typPredvolená hodnotaPopis
$strstring

The string with HTML tags.

$allowable_tagsstring

Tags what we do not want to remove. We state them in one string, for example like '<p><br>'.

Mávratovej hodnoty

Vracia: string

The string without HTML tags, PHP tags and comments.

Príklady

<?php
$s = '<p>Hello, <br />welcome here!</p>';
echo strip_tags($s);

Súvisiace manuály

      • function htmlspecialchars (string $string, int $flags = ENT_COMPAT | ENT_HTML401, string $encoding = ini_get("default_charset"), bool $double_encode = true) : string
      Aktivity