[UPHPU] Coding Correctness
Jennifer Charrey
jcharrey at gmail.com
Fri Oct 10 10:29:17 MDT 2008
Orson Jones wrote:
> Jennifer Charrey wrote:
>> c) The second function does extra work by doing up to two extra mods
>> when the number is not even. If it's an integer and it's not even, it's
>> odd. No need to do two more operations, allow more pathways for bugs
>> (what if you'd forgotten about the -1 case?), make the code less
>> readable, etc.
>
> Ohhh, extra work!
> They missed the extra else, don't forget to cover this case.
The OP used is_int, not is_numeric, so there would be no extra else.
That was my point about "extra work."
But thanks for pointing out that is_numeric allows decimals and
scientific notation as well. When using is_int and is_numeric, be sure
you know what they really do.
Jenn
More information about the UPHPU
mailing list