Using If statement in PHP language
A If statement is a smallest element of any programing language and normally consists of command given by a programmer. A PHP script consist of a series of a statements. A web developer use conditions to execute different functions. These statements can be an assignment, a function call, a conditional statements, or even an empty statement that does nothing. A statement usually ends with a semicolon (;). It can be either an individual statement or a group of statement. It is very useful for a programmer in Website Development Company.
The syntax for if statement is as follows:-
Statement to be executed;
The if keyword is followed by the truth expression in parenthesis. The truth expression can be Boolean variable, a constant, or an expression that evaluates to TRUE, FALSE, or NULL. If the truth expression evaluates to Null or false the statements are not executed.
Now we are going to check whether a triangle is valid using the if statement, in a script named validity.php.
Here is the following code:-
If($a+$b+Sc == 180)
echo”The Triangle is Valid.”;
Here is the output of the script:-
The triangle is valid