numberformat question

Discussion in 'PHP' started by Greenmethod, Nov 1, 2007.

  1. #1
    I have this code on my page:

    				<td></td>
    				<td></td>
    				<td></td>
    				<td>Tax:</td>
    				<td align="right">$<?php echo number_format(258.555,2);?></td>
    				<td></td>
    			</tr>
    			<tr>
    				<td></td>
    				<td></td>
    				<td></td>
    				<td>Total:</td>
    				<td align="right">$<?php echo number_format(3392.555,2)?></td>
    				<td></td>
    			</tr>
    PHP:
    For some reason the first amount gives 258.56 and the second amount gives 3392.55. It was doing the same thing with the variables in there so I put the actual numbers and it does the same thing.. any ideas?
     
    Greenmethod, Nov 1, 2007 IP
  2. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Strange.

    You are talking about the last one not being rounded up to .56, right?
    On my box 'echo number_format(3392.555,2)' gives me 3,392.56.

    What does round give you with the same number?
     
    tamen, Nov 1, 2007 IP