Bopo Posted December 17, 2008 Share Posted December 17, 2008 Hi I have a switch statement, and I am getting the following error when the switch statement is executed: 'Parse error: syntax error, unexpected T_DOUBLE_ARROW' Here's a part of the switch statement switch ($age) { case ($age => 17 && <= 25) { //this line is throwing the error $age = 10; } } Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2008 Share Posted December 17, 2008 => has special meaning and is not a comparison operator. Use >= Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 17, 2008 Share Posted December 17, 2008 Also, you cannot do two comparisons on one value like that. In that statement it doesn't know what you are comparing to be less than or equal to 25. You would need this: case ($age >= 17 && $age <= 25) Quote Link to comment 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.