Learn to use PHP to change character sequences into emoticons or icons by using the str_replace function. You will want to alter the string data as it comes out of the MySQL database for display, not when the data is being inserted into the database.
# USAGE EXAMPLE
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $db_string = "Show me some <3 right now. It is raining today [umbr], that gives me peace [peace]."; echo $db_string; echo "
"; $chars = array("<3", "[peace]", "[umbr]"); $icons = array("❤", "☮", "☂"); $new_str = str_replace($chars,$icons,$db_string); echo $new_str; ?>
0 comments:
Post a Comment