Converting fractions to html entities


We’ve got some fraction information stored in the database, e.g. ¾ ½

Short of doing a search and replace, are there any inbuilt PHP functions that will automatically convert these to proper html entities?


You can use the htmlentities() function. This will replace all special characters with their HTML equivalent. It should do the job.

Answered By – Sam152

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published