|
Posted by Tim Roberts on 10/02/84 11:42
"fiziwig" <fiziwig@yahoo.com> wrote:
>Never mind. I figured it out. A php newbie brain fart. s/b echo
>'Records' . ($start+1); with parens.
That's correct, but do you understand why? The "." and "+" operators have
equal precedence, so the expression gets evaluated left-to-right.
echo 'Records ' . $start+1;
It computes "'Records ' . $start", which it does by converting $start to a
string, producing "Records 0". It then tries to add 1 to it, which it does
by converting the string to an integer. The string becomes 0, so the
result is 1, and that's what gets echoed.
One of the hazards of working with a loosely-typed language.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
[Back to original message]
|