Variables are declared when first used in PHP, so no need for the following...
var $somevar;
In PHP, this is only neccessary when building a class, the var keyword when used inside of a class creates special class-scope static variables.
$myvar = "some value";
Automatically created as a String.
$myvar = 2;
Automatically created as an integer.
$myvar = (string) "Some text";
Typecast as a string explicitly (typecasting is optional in PHP for 99% of variable usages).
$myvar = (int) 45;
Typecast an integer.
When you compare values as in...
if($myvar == "some value")
If myvar does not exist PHP will temporarily create a copy of it in memory with null value for comparision purposes, if error_reporting is set to E_ALL PHP will issue a Notice level error complaining that the variable did not exist. A better method is to use isset() or empty()
if (isset($myvar) && $myvar == "some_value)
http://www.php.net/isset
http://www.php.net/empty
This alleviates that Notice level error.
Always best to read the manual... at
http://www.php.net/manual/en/
Pay special attention to section II, which contains basic syntax, control structures, predefined variables... and general language concepts implemented in PHP.
hth,
: )
Rich
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::