[Tfug] PHP Question
Adrian
choprboy at dakotacom.net
Sat Feb 10 21:53:23 MST 2007
On Saturday 10 February 2007 20:59, George Cohn wrote:
[snip]
> if ($currentWindDirection && $currentWindSpeed)
> {
> fwrite(STDOUT,"STREAM FILE $currentWindDirection \"\"\n");
> fflush(STDOUT);
>
> <stuff omitted>
>
> fwrite(STDOUT,"SAY NUMBER $currentWindSpeed \"\"\n");
> fflush(STDOUT);
> }
>
[snip]
> Problem is, when I use the && to string them on the same line in the if
> statement, the php script ends at that point.
I am confused... This is a snippet of the PHP code you are trying to run? If
so, then yes it probably has a problem. The "if()" statement is looking for a
true/false or 0/non-0 result... giving it a string will likely confuse it.
My guess is that you are trying to say "if $currentWindDirection AND
$currentWindSpeed exist"? If so then it should read:
if (isset($currentWindDirection) && isset($currentWindSpeed)) {
do something
}
Adrian
More information about the tfug
mailing list