Esempio n. 1
0
$fromChangeConvertor->to("ft"); //returns converted value in feet
$fromChangeConvertor->from(5.23,"km"); //sets new from value in new unit
$fromChangeConvertor->to("mi"); //returns converted new value in miles</pre>


		<?php 
$fromChangeConvertor = new Convertor(10, "m");
?>

		<p>10 Meters = <?php 
echo $fromChangeConvertor->to("ft");
?>
 Feet</p>

		<?php 
$fromChangeConvertor->from(5.23, "km");
?>

		<p>5.23 Kilometers = <?php 
echo $fromChangeConvertor->to("mi");
?>
 Miles</p>
	</section>

	<section>
		<header>Result Precision</header>
		<p>The precision of the results can be set using two optional paramerters in the to() function to specify the decimal precision and use of rounding.</p>
		<pre>$precisionConvertor->to("ft", 4, true);</pre>
		<p>The second parameter specifies the decimal precision of the result, the thir parameter indicates weather the result syhould be rounded (true, default value) or truncated (false).</p>

		<?php