views:

159

answers:

6

Hi, something seems to be wrong with the first line of this if function, seems alright to me though.

if ($count1 == sizeof($map) && $count2 == sizeof($map[0])){
echo ";";
}else{
echo ",";
}

This is the error I get (line 36 is the first line of the above line.)

Parse error: parse error in C:\wamp\www\game\mapArrayConvertor.php on line 36

EDIT: The OP notes in an answer below that the error was a missing semi-colon on line 35 and not the code included in the question.

+1  A: 

There appears to be nothing wrong with the syntax of your code. If the behavior is not what you expect, please post more details regarding the value of the variables and the intended and actual behavior of the code.

Daan
+6  A: 

I don't see anything wrong with the code you have posted, so chances are the error is on a previous line. Perhaps a missed semicolon? Mismatched braces or parentheses?

lc
+5  A: 

check the line 35, it could be that line is wrong.

PoweRoy
Oh boy, seems I missed a ";" on line 35, I really must check my code more thoroughly before posting on here, sorry guys :s
Ryan
it is usually the previous line :)
chosta
A: 

Seems I missed a ";" on line 35, sorry guys.

Ryan
No need to apologise, everyone learns this one :)
Ross
This is a notorious PHP error. The ubiquitous missing semi-colon generic error message! lol!
Gary Willoughby
+3  A: 

You could try:

if (($count1 == sizeof($map)) && ($count2 == sizeof($map[0]))){
  //blabla
}
Maiku Mori
I prefer the ().... as well.
altCognito
A: 

You already found the problem, but... if this is just turning an array into a comma separated list, you could use the implode command to do it for you.

R. Bemrose