Page 2 of 2

Posted: Sun Sep 29, 2002 2:17 am
by Takuma
I found it quite difficult to understand but I'm use to it now, it just this looks better

Code: Select all

<?php
$num = $num + 6;
?>
than

Code: Select all

<?php
$num += 6;
?>

Posted: Sun Sep 29, 2002 2:47 am
by volka
I do LOVE +=, |= and so on :D

Posted: Sun Sep 29, 2002 3:54 am
by twigletmac
mydimension wrote:for readability sake, most people find that += is to hard to understand at a quick glance.
IMHO, I think that using it makes things more readable because it has a very specific function. Meaning that at a quick glance

Code: Select all

$var1 += $var2;
is easier to read than

Code: Select all

$var1 = $var1 + $var2;
because you don't have to pay too much attention to the first one.

Like any language some things are a bit tough at first but once you've looked up operators in the manual all those +='s and .='s start to make a bit more sense.

Mac

Posted: Mon Sep 30, 2002 6:31 pm
by Zoram
If i am just interested in the hours not how many days it adds up to and all is there a way to just have hours.. (ex instead of 13 days have 312 hours?)