Jump to content

[SOLVED] limiting the zecimal numbers


alin19

Recommended Posts

<?php

 

if($_SERVER['REQUEST_METHOD'] == 'POST')

 

{

$a = $_POST['unu'];

$b = $_POST['doi'];

$c = $_POST['trei'];

$d = $_POST['patru'];

$x = ($a*100+$d*$c)/(100+$c+$b);

}

 

?>

<html>

<table>

<form>

 

<td height="35" valign="" align="center"><font color="green" size="8" ><?php if(isset($x)) { echo $x; }

?> </font></td>

  </tr>

</table>

</form>

</html>

 

i get a number like this : 2.9150943396226  i want to get something like this :  2.91

 

what i must add?

 

Link to comment
https://forums.phpfreaks.com/topic/84842-solved-limiting-the-zecimal-numbers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.