Share on Google+Share on Google+

PHP Expression

Advertisement
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

Advertisements

Posted on: March 19, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.