Lassie Posted November 16, 2016 Share Posted November 16, 2016 I want to modify a script that send SMS and I am using a switch statement to send different messages dependent on a condition. The original script works fine but no message is sent with my modified script. I wonder if some part is out of scope? Switch SMS.php Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted November 16, 2016 Solution Share Posted November 16, 2016 (edited) $Clue_No isn't the same as $Clue_no. PHP variables are case-sensitive. If you get a proper IDE, it will actually point out trivial mistakes like this and save you a lot of time. Also note that your default case will trigger an error when you try to access $result, because there won't be such variable. You should fix your logic. Personally, I would avoid magic numbers and switch statements at all costs, because it quickly turns the code into an unreadable mess. Edited November 16, 2016 by Jacques1 Quote Link to comment Share on other sites More sharing options...
Lassie Posted November 16, 2016 Author Share Posted November 16, 2016 Thank you very much. Will do. 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.