levanthai Posted September 12, 2018 Share Posted September 12, 2018 Hey guys! Thanks for your patience here... I know that I still have a lot to learn but I am trying to understand some of the basic of the if and else statement.... I have two separate codes and the first one is part of a longer code but not how to find out which part of the {} I should put the else statement, I guess I shouldn't be guessing at all.... thanks! Quote Link to comment Share on other sites More sharing options...
Barand Posted September 12, 2018 Share Posted September 12, 2018 http://php.net/manual/en/language.control-structures.php Quote Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted September 12, 2018 Share Posted September 12, 2018 Student was given assignment to RTFM. Student was graded on assignment using a simple question/answer sheet. Teacher graded students question/answer sheet and put grade into a variable called $student_grade < if($student_grade === "Passed"){ //student passed question/answer sheet so.... echo "Great job, you RTFM"; } else{ //student failed question/answer sheet so.... echo "You did not RTFM"; } > Quote Link to comment Share on other sites More sharing options...
gizmola Posted September 13, 2018 Share Posted September 13, 2018 An if -else construct branches on the truthiness of the condition. if (condition) { // This block executes if condition evaluates as TRUE } else { // This block executes if condition evaluates as FALSE } Note that in PHP the condition must be enclosed within parens ie. (). There is really nothing more to it than that. If you have a more specific question, let us know. 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.