Hi Gary,
2009/5/5 Gary <gwp...@ptd.net>:
> Jan
>
> Thanks for your note.
>
> So your wrote:
>
> $x = (3)*(2) makes no sense.
> $x = 3 * 2 works, as
> $x = (3 * 2) does, too.
> But this is not an error at all.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>
> In the first example($x = (3)*(2) makes no sense.), which is the way I have
> it, works.  So if it works, is there a real compelling reason to change it?

No!

> I understand that "less is more" when it comes to writing code, but does it
> slow things down, does it give erroneus results, or is it developing a poor
> writing habit?
>
> I would enjoy your opinion.

It's an opinion thing, I'd say.
But having single values in brackets can't speed anything up. if
anything, it' gonna be slower.
Anyway, this was just meant as a comment, that's why I wrote "this is
not an error".

I for myself believe that a lot of bracket enclosing can make code
more unreadable, but on the other hand sometimes you want more
bracket-enclosed statements.

if (1 == 2 || (2 != 3 && 3 != 4)) { /* this would be my approach */ }

if (1 == 2 || ((2 != 3) && (3 != 4))) {
/* this makes it harder to read for me, because of the ending ")))"
   I think, that this may be slightly faster for the interpreter.
*/
}

if (((1) == (2)) || (((2) != (3)) && ((3 != 4)))) { /* this is
overkill for humans and interpreter */ }


My intention to post actually was to tell you about the wrong
IF-Statement way down. I removed the quoting around, now:

> 2009/5/5 Gary <gwp...@ptd.net>:
>> elseif(isset($chester_assess_difference) <=1000){
>
>
> You got an error here.
>
> isset($var) returns "true" OR "false", which equals 1 OR 0.
> You might not compare it with your integer 1000, because it's always
> smaller.
>
> correct would be:
>
> elseif (isset($chester_assess_difference)
>      && $chester_assess_difference <= 1000) {
>        // do something
> }
>


Regards,
Jan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to