PHP Expressions


Expressions are an important concept in PHP, and expressions can be understood as "anything of value." For the syntax of expressions in this tutorial, we express the expression as "expr".

Here is an expression:

$x > $y;

In the above example, when the value of $x is greater than $y, the expression evaluates to TRUE, otherwise it evaluates to FALSE.

We often determine the value of an expression(including specific values and Boolean values) to determine the logic of our next step, as in the following example:

if($x > $y) {
  echo " x > y ";
}

The example uses the if logic to determine that the condition is the $x>$y expression in parentheses. If $x>$y is true(TRUE), then the word "y>x" is printed. Of course, the actual situation will be much more complex.

Expressions exist extensively in our PHP programming.




Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook