HTML Special Characters

Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.

Moderator: General Moderators

Post Reply
pHp_n0ob
Forum Commoner
Posts: 35
Joined: Mon Jul 09, 2012 7:30 am
Location: India

HTML Special Characters

Post by pHp_n0ob »

It will show you some HTML Special Characters you dont even know!
Works best with Mozilla Firefox.

Code: Select all

<?php
echo  '<html>
<head>
<title>HTML Special Characters</title>
</head>
</body>
<center><h2>HTML Special Characters</h2>
<font color="green">Values</font> - <font color="red">Chars</font></center>' ;
for($i=2;$i<=11097;$i++){
$post_bg=($bg++%2==0 )?"background-color:black;color:white":"background-color:white;color:black";
echo '<div style="'.$post_bg . ';text-align:center">
<font color="green">&#'.$i.';</font>-<font color="red">&#'.$i. ';</font>
</div>';
}
echo  '</body>
</html>' ;
?>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: HTML Special Characters

Post by requinix »

Decimal HTML entities, yeah. You can do it in hex too.
kiash
Forum Newbie
Posts: 7
Joined: Sat Aug 07, 2021 1:42 am
Contact:

Re: HTML Special Characters

Post by kiash »

you can use

Code: Select all

htmlentities
function to encode all html entities. it will then very safe for your code
I am a full stack developer. My persoal site Kiash.io and I work for Slide.pub as a lead developer.
Post Reply