Simple PHP calculation in postbit
Im trying to do a simple calculation in my postbit. Bascially it square roots a vb value and displays the answer to 1 significant figure.
For example if the value is 6 then the real answer would be 2.449... but it would display it as 2. I know pratically nothing about php, so all i have so far is this (which is probably wrong already):
<?php
echo sqrt($input);
?>
Can anyone help me on where i would go from here? It would be much appreciated.
James
EDIT:
Right im a little bit further on thanks to nick from vbnova. To get it to 0 decimal places ( i dont want to round the numbers up / down) ive got this code:
$number = 1.953434;
$number = str_split($number);
$number = $number[0];
But i really dont know how to put these two codes together. Can anyone help me out?
|