AFBlue78 Posted May 3, 2009 Share Posted May 3, 2009 Hello to all, I can use some advice as quickly as possible. I am working on a final project and need some assistance in clearing an "Is Equal To" Parse error. The error starts with the "If" statement before the ($n1 == n$2 ==$n3). Below is the portion of the code that is causing the error. If I comment this out the rest of the project works. I am under a tight time deadline for this. Thank you for reviewing and providing ideas. if$n1 == $n2 == $n3 { $credits += 100; print("Congratulations, you won 100 Credits!"); }elseif{($n1 == $n2 OR $n2 == $n3 OR $n1 == $n3) // Make sure to check for $n1 matching $n3!! } { $credits += 10; print("Winner! Here's 10 credits!"); } else { print("Sorry! Try Again!"); } //Subtract credits for playing $credits -= 1; else { //The player doesn't have any credits to play print ("You don't have any credits left to play with!"); }{ } else { // The user hasn't played yet, give the player 25 credits // $credits = 10; } Quote Link to comment https://forums.phpfreaks.com/topic/156716-is-equal-to-parse-error/ Share on other sites More sharing options...
Maq Posted May 3, 2009 Share Posted May 3, 2009 You were missing '(' and ')' around your conditions. You also should specify each condition with '&&' or 'OR'. if($n1 == $n2 && $n1 == $n3) { Quote Link to comment https://forums.phpfreaks.com/topic/156716-is-equal-to-parse-error/#findComment-825230 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Learn syntax! if (condition_here) { // do something } else if (condition2_here) { // do something else } Now incorporate that into your code. In addition to Maq's reply, you have an opening { in your else if clause. Again, just use my template. Quote Link to comment https://forums.phpfreaks.com/topic/156716-is-equal-to-parse-error/#findComment-825233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.