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; } } Link to comment https://forums.phpfreaks.com/topic/137367-syntax-error/ 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 >= Link to comment https://forums.phpfreaks.com/topic/137367-syntax-error/#findComment-717709 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) Link to comment https://forums.phpfreaks.com/topic/137367-syntax-error/#findComment-717713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.