CKTIS / PHP
htmlentities()
Prevedie znaky majúce vo vybranom type dokumentu HTML entitu na túto entitu.
Verzia: PHP 8.4; repository runtime, production runtime not attested
Syntax
htmlentities(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null, bool $double_encode = true): stringPrevedie znaky majúce vo vybranom type dokumentu HTML entitu na túto entitu. ENT_QUOTES zahŕňa oba typy úvodzoviek. Zadajte kódovanie a double_encode=false na zachovanie známych entít. Ostatné znaky zostanú textom.
Signatúra
htmlentities(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null, bool $double_encode = true): string
Výstup príkladu
café & Q
café & Q
Príklady
<?php
echo htmlentities("caf\u{00E9} & Q",ENT_QUOTES|ENT_HTML401,"UTF-8",false), PHP_EOL;
echo htmlentities("caf\u{00E9} & Q",ENT_QUOTES|ENT_HTML401,"UTF-8",true);
Výsledok
café & Q café &amp; Q