Whilst working on an E-commerce website, written in PHP i came across and issue where i had a price stored in a table as a float.
I wanted to split the pounds, and pence into two variables to make it easier to work with, but then save the results back into 1 field. So this is what i did.
//If you want to split a price (float) into pounds and pence. //or dollors and cents etc etc. $price = "6.20"; $split = explode(".", $price); $pound = $split; // piece1 $pence = $split; // piece2 echo "£ $pound . $pencen";</span></code>