You can accomplish this by incorporating conditional statements into your code. The conditional statements in PHP are as follows: if statement: executes code if one of the conditions is true. If a condition is true, the if… else statement runs some code, and if it is false, it runs another code.