PHP flow control if else syntax
if and else syntax
This is a very important chapter and an important syntax in PHP.
[Note] My definition level of this grammar is: tacit writing level. That is, you can write it with your eyes closed if you need it.
Explanation in English:
*if *Pronunciation: [ɪf]
Explanation in Chinese: If
##elsePronunciation: [ɛls]Chinese explanation: Otherwise
Many people like to buy lottery tickets. Let’s use the process of buying lottery tickets to write an example of if. In the chapter "3.2.2 Boolean is the Knowledge of the Book of Changes", I gave you a wretched example:
For example, a sentence often mentioned in TV dramas :If I get that beautiful girl (handsome guy), I am willing to die.
Then: I am willing to die
If I don’t pick up a beautiful girl
Then: I am not willing to die This is it:
For the above example, we can completely use if...else... to translate it into code:
在if...In
else, we write another example that can be enclosed in curly brackets and have multiple sentences: