PHP Expression


 

PHP Expression

In this tutorial we will study about PHP expression, expression could be anything we write. Examples in this simple tutorial will make it more clear.

In this tutorial we will study about PHP expression, expression could be anything we write. Examples in this simple tutorial will make it more clear.

PHP Expressions:

In every language expression plays a vital role, in PHP whatever you write is an expression (almost anything). Anything has a value is an expression and this is the easiest way to define and understand expression.

Variables and constants make an expression,

$var=323;

In the above example $var is a variable and 323 is a constant value.

Following examples will try to make the concepts more clear, hopefully you have the concept of  Expression functions in PHP:

PHP Regular Expression Example:

<?php

function disp()

{

$a=23;

return $a;

}

echo disp();

?>

Output:

23

Example:

<?php

function disp()

{

echo $a=23;

}

disp();

?>

Output:

23

Ads