Insert Decimal Point in Number Value

Is it possible to take a number that has been generated by a series of multiplied variables and insert a decimal point?

Here’s what I working with:

The PHP looks a little like this: $J13 = $G7*$G11*$G13*$G150.005$G17; where $G7, $G11 etc represent variables containing user inputted numbers.

The user inputted HTML for example could look like this; (values pre-inserted for this example)

	<input name="G7" type="text" id="G7" value="2.4" />
	<input name="G11" type="text" id="G11" value="40" />
	<input name="G13" type="text" id="G13" value="10" />
	<input name="G15" type="text" id="G15" value="18" />
	<input name="G17" type="text" id="G17" value="45" />

Using PHP to process this, it gives a number value of 3888.

This is where the problem lies, I need this number be output like this: 38.88 - like currency I guess.

Is this at all possible to achieve?

Divide by one hundred.

1 Like

Wouldn’t the number_format function work for this?

http://php.net/manual/en/function.number-format.php

You may sense that maths isn’t my strong point…

Thank you for your help and for making me feel stupid!! :blush:

You’re welcome. :smiley:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.