Re: [PHP] Round



Koen van den Boogaart wrote:
Is it expected behaviour that

<?php var_dump( round(-0.26) ); ?>

outputs

float(-0)


Yes. You (probably) want:

<?php
var_dump(round(-0.26, 1));
?>

http://uk.php.net/manual/en/function.round.php

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support
.



Relevant Pages

  • Just to confirm...
    ... Emails that bounce get sent back to the address in the Return-Path: header. ... Richard Heyes ... Knowledge Base and HelpDesk software ...
    (php.general)
  • Re: [PHP] Question About Blocking Email Addresses in Forms
    ... I made a class which converted numbers to text (TextualNumbers IIRC) and it got broken. ... Richard Heyes ... Knowledge Base and Helpdesk software that eases your support ...
    (php.general)
  • PEAR website and MSIE 6
    ... It consistently crashes for me. ... Richard Heyes ... Knowledge Base and Helpdesk software for £299pa hosted for you - ...
    (php.general)
  • Re: [PHP] Round
    ... Probably a precision thing. ... Richard Heyes ... Knowledge Base and HelpDesk software ...
    (php.general)
  • Re: [PHP] Re: website tree
    ... Richard Heyes ... Knowledge Base and HelpDesk software ...
    (php.general)