<html>
<body>
<?php
$str = "Jane & 'Tarzan' () ";
echo htmlspecialchars($str, ENT_COMPAT);
echo "<br />";
echo htmlspecialchars($str, ENT_QUOTES);
echo "<br />";
echo htmlspecialchars($str, ENT_NOQUOTES);
?>
</body>
</html>
The quote style. One of the following constants:
Constant Name | Description |
---|---|
ENT_COMPAT | Will convert double-quotes and leave single-quotes alone (default) |
ENT_QUOTES | Will convert both double and single quotes |
ENT_NOQUOTES | Will leave both double and single quotes unconverted |
- htmlspecialchars_decode
<?php
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str);
// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>
- 아스키
* chr (ASCII 번호) : ASCII 번호에 해당하는 문자를 리턴
* ord ("문자") : 문자에 해당하는 ASCII 번호를 리턴
<?php
echo ord(")");
echo chr(40);
?>
Posted by 홍반장