AgerNic.com/ro
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
Tutorial
Funcția htmlspecialchars din PHP este utilizată pentru a converti caractere în entități HTML corespunzătoare, după caz. Este utilizat pentru a codifica intrarea utilizatorului pe un site web, astfel încât utilizatorii să nu poată introduce coduri HTML dăunătoare într-un site.

Syntax:
htmlspecialchars(string,flags,character-set,double_encode)
Exemplu 1:
<?php
$text = "Aici avem o propozitie cu caractere <b>ingrosate</b>.";
echo htmlspecialchars($text);
?>
Ieșirea HTML a codului de mai sus va fi (View Source):
<!DOCTYPE html>
<html>
<body>
Aici avem o propozitie cu caractere &lt;b&gt;ingrosate&lt;/b&gt; .
</body>
</html>
Exemplu 2:
<?php
$convert = "<li><a href='index.php'>Cursuri PHP online cu agernic.com</a></li>";
echo "Original string : ".$convert;
echo "<br />";
htmlspecialchars("<li><a href='index.php'>Cursuri PHP online</a></li>", ENT_QUOTES);
echo "Numai HTML caractere speciale : ".htmlspecialchars($convert);
?>
Tags: htmlspecialchars() PHP online editor

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


analytics piwika