Lucky13
Lucky13

Reputation: 11493

special characters in php

I want to display some chemistry equations like 23Na40K (source).

This value is in my database. Now it's display like this $^{23}$Na$^{40}$K. I tried to use html_entity_decode(), utf8_decode(), stripslashes(). Nothing works for me. Please help me to resolve this.

Upvotes: 0

Views: 134

Answers (4)

Some Dinosaur
Some Dinosaur

Reputation: 164

I havent seen anyone mention these:
¹²³⁴⁵⁶⁷⁸⁹⁰

Which are some Unicode Characters which don't look as good as the Superscript Tags but, if you still want to use HTML entities here they are:
¹²³⁴⁵⁶⁷⁸⁹⁰

Heres a comparison

HTML Tags: <sup>23</sup>Na<sup>40</sup>K
<br>Or<br>
HTML Entities: &sup2;&sup3;Na&#8308;&#8304;K

Upvotes: 0

user6029681
user6029681

Reputation:

You can use an Equation HTML generator and use it into your website.

Or, you can also use Latex for displaying full equation html.

Upvotes: 0

ST2OD
ST2OD

Reputation: 725

23Na40K

<sup>23</sup>Na<sup>40</sup>K

And

H2O

H<sub>2</sub>O

Upvotes: 3

node_modules
node_modules

Reputation: 4925

This can be done with Superscript in HTML like this:

Output: 23Na40K

<sup>23</sup>Na<sup>40</sup>K

Upvotes: 0

Related Questions