NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:
Funkce, kterou se snažíš použít je dostupná pouze pro registrované uživatele. Buďto se přihlas nebo si zdarma vytvoř nový účet.

PHP - htmlspecialchars_decode

Trieda

Koreň \ Bez triedy

Metóda - htmlspecialchars_decode

(PHP 5 >= 5.1.0, PHP 7)

The opposite function of htmlspecialchars(). It converts entities back to special characters.

Procedurálne

Parametre

NázovDátový typPredvolená hodnotaPopis
$stringstring

The string to decode.

$flagsint ENT_COMPAT | ENT_HTML401

We can set so-called flags as the second parameter. These are constants changing the behavior of the function. These constants can be joined by |. The list of them is as follows:

ENT_COMPAT Converts quotation marks and keeps apostrophes.
ENT_QUOTES Converts quotation marks and apostrophes.
ENT_NOQUOTES Keeps quotation marks and apostrophes.
ENT_HTML401 Handles code as HTML 4.01.
ENT_XML1 Handles code as XML 1.
ENT_XHTML Handles code as XHTML.
ENT_HTML5 Handles code as HTML 5.

Mávratovej hodnoty

Vracia: string

The decoded string.

Príklady

<?php
$s = '&lt;a href=&quot;index.php?a=1&amp;b=2&quot;&gt;Link&lt;/a&gt;';
echo htmlspecialchars_decode($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