Re: If statement trouble
AceX wrote:
> I'm having trouble with this if statement:
>
> if($line[$c]=$ignore
> {
> $num--;
> }
>
>
> $ignore is defined as the string "ig"
>
> $line is an array containing 5 items, some of which may be "ig"
>
> $num starts out as a number representing the number of values in $line
In addition to using an assignment operator (=) instead of comparison
(==), you are also missing a close parenthesis:
if($line[$c]=$ignore
should be
if($line[$c]==$ignore)
And, yes, the brackets are not NEEDED if you have only one statement,
but they don't hurt.
|