Hello friends, We have passed the last PHP class today. Today, I will describe the algorithm system in PHP. First of all, I explain the algorithm in short, what is the algorithm. The algorithm is basically a yes / no or if / not a tree. You may even have seen it in textbooks at school, you are starting from somewhere, and if you are right or wrong, you are following that path and eventually you reach the door number x. That's an algorithm. Leaving only PHP, algorithms, which are among the most essential of coding languages, can create dozens of operations, logic and events. Algorithms in PHP "if" statement The if command, in Turkish, is used to start an algorithm. A conditional formula is specified by some mathematical operators with the elements ta as the arguments of the if command. That is, if the number 1 is less than 2, we can transfer it through the operators for the if command. Example Showing: if (1 <2) { // Events } Here, we say that if the number 1 is less than 2, the events in the brackets will be. Now let's get to know these operators a bit. <Less than > Greater than <= Less than or equal > = greater than or equal == equal ! = Not equal if the same === ! == If it is not Representative Formulas: 5 <10 number 5, 10 is less than ... (TRUE) 10> 5 10 number is greater than the number 5 ... (TRUE) 6 <= 8, number 6, less than or equal to the 8 digits ... ( TRUE) 12> = 6 If 12 is greater than or equal to 6 ... (TRUE) 5 == 5 If 5 is equal to 5 ... (TRUE) 5! = 6 If the 5 is not equal to 6 ... (TRUE) 5 === 5 of 5 digits in the integer types, if they are identical with the number 5 on the Integer type ... (TRUE) 5! == '5' Integer type in the number 5, the same is with the number 5 String type ... (FALSE) Attention ! You can use a command that tells you something like variable or constant instead of number. We have seen variable types; true / false, integer-string etc ... are also valid here. Now, let's get to know the connect operators a bit. The ones in the word and the ones in symbol have the same function. Both can be used. and - && and or - || or xor - ^^ privileged or ! if now to these, for example, number 1 and the third digit, the second digit is not equal to or use like multiple purposes, such as writing formula juxtaposed. I would give a slightly mixed formula: if (5 && 10! = 5+ (5/2) +3) { // ... } where 5 is the number 10 and if 5 is not equal to 3, ..I said. You can remember the parentheses in the mathematical operation precedence. The same is true here. Yes, I know you're pretty confused, but that's how I got it. If you do not understand, please write your comment to describe your problem. "else" Say Else, "If not" by Turkic, is the second building block of Algorithm. If it is inconsistent with a form, and if the "else" is defined, the codes in the else are processed. It's not called if. Example Usage: $ x = 16; if (10 + 7 <$ x) { echo 10 + 7. ' number, '. $ x.' is small. '; } else { echo 10 + 7. ' number, '. $ x.' '.'; I created a variable named x and set its value to 16. Then I opened an if statement and I declared it as a formula: if 10 + 7 (17) is greater than $ x (16); The screen is 17, 16 is smaller. I said print. But the number 17, the number 16, of course, is big, so we will work on the other else. As we say elsewhere; 17 is the number, 16 is the number of the output is taken with echo. Therefore, this text will appear on the screen, so the else statement will work. This is the "elseif" statement , if not ... in the sense. So with a formula that does not hold, the second additional formula is used to specify the condition. So, if the statement does not flush, Elseif will match my other condition in my statement. If this holds true, the events in the elseif statement will work. If this is not happening, either the operation will be stopped or at the bottom if I have specified else statement will work automatically. Example Usage: if (10 <5) { echo "10 is smaller than 5"; } elseif (10> 5) { echo "10 is greater than 5"; } Haliylede, because 10 is bigger than 5 elseif will keep the condition in my statement, and this is going to happen. Let's look at an example like this: if (1000 <1000-1) { echo "1000," 1000-1. " echo "1000, equal to" 1000-1. ""; } else { echo "1000," 1000-1. " } Let's look at our Once If statement. 1000 is not smaller than 999. This condition is skipped and let's look at the elseif condition. 1000 is not equal to 999, in which case the else statement will run automatically and the screen is bigger than 1000, 999. The text will be printed. Attention! The elseif statement always precedes the else. If you write else after the if statement and immediately specify the elseif statement, you will get an error. Because no condition is specified in else. Because this statement works when there is no condition. The runner is not dependent. Good luck with.