Php Expressions

The expression is a anything that has a value .The most basic forms of expressions are constants and variables.

Example when you type $b=10, you are assigning 10 in to $b. 10 is a expression which also integer constant.

Expressions Example :


<?php
function test ()
{
return 10;
}
?>

you are familiar with the concept of functions you did not assume that typing $c = test() ,alternative you can writing $c = 5 and you are write. Functions are expressions with the value of their return value. the value of the expression 'foo()' is 5.

Here ternary conditional operator:

<?php
$first ? $second : $third
?>

If the value of the first subexpression is TRUE (any value have), then the second subexpression is false, and that is the result of the conditional expression. Otherwise, the third subexpression is evaluated, and that is the value.