PHP - strip_tags
Trieda
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ázov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $str | string | The string with HTML tags. | |
| $allowable_tags | string | Tags what we do not want to remove. We state them in one string, for example
like |
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
