Q:

Format decimal output from sql query

Is it possible to split up the result of the following sql query in html that way to style the decimals? 
<? php
$sql = "SELECT * FROM vendordb_3_postmeta WHERE meta_id = 25";
foreach ($pdo->query($sql) as $row) {
    echo $row['meta_value']."<br />";
}
? >

The output is a product-price like 999.99 The aim is to style the decimals superscript.  

A:

If you want to format a part of the string, you'll need to split it up into pieces that can be formatted separately.  
If you want a result like 

99999

you can split it up using explode().  This will split your 999.99 into an array with two elements, 999 and 99 (what's before and what's after the separator).  You can then format it like below
$values = explode(".",  $row['meta_value']);
echo $values[0]."<sup>".$values[1]."</sup><br />";

References

http://www.php.net/explode

