Reputation: 12335
Symbols such as: ♫
http://www.chatsmileysemoticons.com/music-symbol-twitter/
So that I can do something like:
$tweet = '♫'.$tweet.$play_song_url;
Upvotes: 0
Views: 666
Reputation: 401022
If you are writting your PHP source code in UTF-8, you can directly use that "special" character :
header('Content-type: text/html; charset=UTF-8');
$tweet = '♫' . ' Hello !';
echo $tweet;
Will get you the expected output -- I've just tried.
Note that your browser must, of course, display the page as UTF-8 -- this explain why I sent the correct header.
You can also use the HTML code of the character you want, and use html_entity_decode
to convert them to a single character :
header('Content-type: text/html; charset=UTF-8');
$tweet = html_entity_decode('♫', ENT_COMPAT, 'UTF-8') . ' Hello !';
echo $tweet;
The problem being finding the right HTML-entity code ^^
Upvotes: 4
Reputation: 3372
You can just echo out the html character entities, if supported. Something like
echo "You have my ♥ so I'll give you a ♦";
Here is a good list of html character entities.
Upvotes: 0
Reputation: 72540
You can do one of two things:
♩ ♪ ♫ ♬ ♭ ♮ ♯
<head>
section of your HTML: <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Upvotes: 3
Reputation: 625097
They're Unicode characters. Just make sure your HTML is UTF-8 and you can then use entities like:
–
For example: –
Upvotes: 4