Re: Negative numbers

From: Date: Tue, 02 Jan 2001 21:20:05 +0000
Subject: Re: Negative numbers
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-32359@lists.php.net to get a copy of this message
On Tue, Jan 02, 2001 at 01:15:14PM -0800, Rasmus Lerdorf wrote: > You are doing something very wrong somewhere. $addon will be 1200 after > this bit of code. > On Tue, 2 Jan 2001, John LYC wrote: > > > > > HOw do i represent and do calculation on negative values? > > due to current situation i need to do this... > > > > > > $duration = 3000; //in sec > > $Break = -1800; //in sec > > $addon = $duration+$Break; > > > > result should be 1200 > > but php now returns 4800 > > even when i try quoting the negative values of Break. Not tested, but my mathematically feeling says: $addon = $duration+$Break; // 1200 $addon = $duration-$Break; // 4800 -Egon -- http://www.linuxtag.de/ http://php.net/books.php http://www.concert-band.de/

« previous php.general (#32359) next »