Monday, May 30, 2011

difference between $ and $$ php or static and dynamic variable

<?php
//difference between $ and $$ php or static and dynamic variable
$message = 'name';
$name = 'afroz';
echo '$message='.$message;//outputs - $message=name
echo '$$message='.$$message;//outputs - '$$message=afroz
?>

Tuesday, May 24, 2011

Difference between '=', "==" and '===' in PHP

=        sign is an assignment - take what's on the right as an expression and save it in the variable named on the left.

==        sign is a comparison and tests whether the variable / expression / constant to the left has the same value as the variable / expression / constant to the right.

===        sign is a comparison to see whether two variables / expresions / constants are equal AND have the same type - i.e. both are strings or both are integers.